This file contains 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 random_lipsum($amount = 1, $what = 'paras') { | |
$start = rand(0,30); | |
return simplexml_load_file("http://www.lipsum.com/feed/xml?amount=$amount&what=$what&start=$start")->lipsum; | |
} |
This file contains 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
//requires authentication | |
add_filter('json_query_vars','accept_new_queries'); | |
add_filter('json_query_var-tax_query', 'filter_by_taxonomy'); | |
function accept_new_queries($filters){ | |
return array_merge($filters,array('tax_query')); | |
} | |
function filter_by_taxonomy($val){ |
This file contains 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
//Note: requires the Basic Auth plugin | |
$username = 'username'; | |
$password = 'password'; | |
$args = array( | |
'headers' => array( | |
'Authorization' => 'Basic ' . base64_encode( $username . ':' . $password ), | |
), | |
); | |
$queryFilters = array( |
This file contains 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
$taxs = get_taxonomies(); | |
foreach($taxs as $tax){ | |
$args = array( | |
'hide_empty'=> false, | |
); | |
$terms = get_terms($tax,$args); | |
$termIDs = array(); //we need an array of IDs from all the terms in this taxonomy | |
foreach($terms as $term){ | |
$termIDs[] = $term->term_id; | |
} |
This file contains 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
add_filter( 'page_attributes_dropdown_pages_args', 'so_3538267_enable_drafts_parents' ); | |
add_filter( 'quick_edit_dropdown_pages_args', 'so_3538267_enable_drafts_parents' ); | |
function so_3538267_enable_drafts_parents( $args ){ | |
$args['post_status'] = 'draft,publish,pending'; | |
return $args; | |
} |
This file contains 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
'tax_query'=> array( | |
array( | |
'taxonomy' => 'decade', | |
'field' => 'id', | |
'terms' => $decadesArray, | |
'operator' => 'NOT IN' | |
) | |
) |
This file contains 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
insert into wp_postmeta (post_id, meta_key, meta_value) select ID, '###FIELDNAME###', '1' from wp_posts WHERE post_type = '###POSTTYPE###' |
This file contains 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
$args = array( | |
'post_type'=> 'post', | |
'post_status' => 'publish', | |
'order' => 'DESC', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'post_format', | |
'field' => 'slug', | |
'terms' => array( 'post-format-video' ), | |
'operator' => 'NOT IN' |
This file contains 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
$args = array( | |
'post_status' => 'publish', | |
'post_type' => '###POSTTYPE###', | |
'meta_key' => '###METAKEY###', | |
'orderby' => 'meta_value_num', | |
'order' => 'DESC' | |
); |
This file contains 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 add_grav_forms(){ | |
$role = get_role('editor'); | |
$role->add_cap('gform_full_access'); | |
} | |
add_action('admin_init','add_grav_forms'); |
OlderNewer