This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name github | |
// @namespace YOURNAMESPACEHERE | |
// @description modify github bring back light header | |
// @include https://github.com/* | |
// @include https://gist.github.com/* | |
// @version 1 | |
// @grant none | |
// @require https://code.jquery.com/jquery-1.12.4.min.js | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function excel_case_study_results($posts) { | |
/* | |
this function is called in the content area of | |
either the post type archive template or | |
the either taxonomy archive template like this | |
if (have_posts()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
if (typeof acf.add_action !== 'undefined') { | |
acf.add_filter('select2_args', function(args, element, settings) { | |
if (element.hasClass('glyphicons-select') || element.hasClass('glyphicon_selector')) { | |
args['dropdownCss']['font-family'] = 'Glyphicons Regular'; | |
} | |
return args; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acf.add_filter('validation_complete', function( json, $form ){ | |
if(json.errors) { | |
var field = jQuery('[name="' + json.errors[0].input + '"]', $form).parents('.acf-field'); | |
field = field[field.length - 1]; | |
var tab = jQuery(field, $form).prev('.acf-field-tab').attr('data-key'); | |
jQuery('.acf-tab-wrap a[data-key=' + tab + ']', $form).click(); | |
} | |
return json; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEFORE - UNSERIALIZED | |
Array | |
( | |
[width] => 500 | |
[height] => 500 | |
[file] => 2016/07/HAWK-1.jpg | |
[sizes] => Array | |
( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
ACF cusomt location rule : Page Ancestor | |
*/ | |
add_filter('acf/location/rule_types', 'acf_location_rules_page_ancestor'); | |
function acf_location_rules_page_ancestor($choices) { | |
$choices['Page']['page_ancestor'] = 'Page Ancestor'; | |
return $choices; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Adds a custom location rule to ACF to select page grandparent | |
*/ | |
add_filter('acf/location/rule_types', 'acf_location_rules_page_grandparent'); | |
function acf_location_rules_page_grandparent($choices) { | |
$choices['Page']['page_grandparent'] = 'Page Grandparent'; | |
return $choices; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// example, set posts_per_page on CTP "book" | |
function books_pre_get_posts($query=false) { | |
if (is_admin() || | |
!$query || | |
!is_a($query, 'WP_Query') || | |
!$query->is_main_query()) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'posts_request', 'pre_db_hit' ); | |
function pre_db_hit( $request ) | |
{ | |
global $diy_cache_current_request; | |
$diy_cache_current_request = $request; | |
// use request string to see if expired... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Query Thief | |
* Description: Hijacking the main WordPress query and loop for fun and profit | |
* Version: 0.1 | |
*/ | |
// I namespace everything now that PHP 5.2.4 is the minimum requirement. :D | |
namespace JPB; |
NewerOlder