Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
<?php | |
// ********************* START CONFIGURATION ********************* | |
// Set up an incoming webhook at https://YOURDOMAIN.slack.com/apps/manage/custom-integrations | |
define( 'SLACK_INCOMING_WEBHOOK', 'https://hooks.slack.com/services/TXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX' ); | |
// Set your data folder, which is used to prevent multiple notifications for the same song :) | |
define( 'DATA_FOLDER', './hottest100-data' ); |
<?php | |
function the_acf_field($acf) { | |
$field = get_field($acf); | |
if(!$field) { | |
$field = get_sub_field($acf); | |
} | |
echo $field; |
<?php | |
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */ | |
function sb_user_meta( $data, $field_name, $request ) { | |
if( $data['id'] ){ | |
$user_meta = get_user_meta( $data['id'] ); | |
} | |
if ( !$user_meta ) { | |
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) ); | |
} |
<?php | |
/** | |
* Make an internal REST request | |
* | |
* @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server). | |
* @param $request_or_method WP_REST_Request|string A WP_REST_Request object or a request method | |
* @param $path (optional) if the path is not specific in the rest request, specify it here | |
* @param $data (optional) option data for the request. | |
* @return WP_Error|mixed |
<?php | |
add_filter( 'rest_pre_dispatch', function() { | |
if ( ! is_user_logged_in() ) { | |
return new WP_Error( 'not-logged-in', 'API Requests are only supported for authenticated requests', array( 'status' => 401 ) ); | |
} | |
} ); |
<?php | |
// This is a temporary solution until register_post_type_args is available | |
// After adding your CPT, you can find it at mysite.com/wp-json/wp/v2/[slug] | |
function sb_add_cpts_to_api() { | |
global $wp_post_types; | |
// Add CPT slugs here | |
$arr = ['fake','movie','books']; |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Blue Component</key> | |
<real>0.19607843137254902</real> | |
<key>Green Component</key> | |
<real>0.16078431372549021</real> |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
// Custom Dashboard widgets | |
function custom_dashboard_widgets() { | |
global $wp_meta_boxes; | |
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] ); | |
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] ); |
<?php | |
//Deletes all CSS classes and id's, except for those listed in the array below | |
function custom_wp_nav_menu($var) { | |
return is_array($var) ? array_intersect($var, array( | |
//List of allowed menu classes | |
'current_page_item', | |
'current_page_parent', | |
'current_page_ancestor', | |
'first', | |
'last', |