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
<?php | |
add_action( 'after_setup_theme', 'wphc_theme_setup' ); | |
function wphc_theme_setup() { | |
add_theme_support( 'html5', array( | |
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' | |
) ); | |
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
<?php | |
add_action( 'pre_get_posts', 'wphc_modify_orderby_books' ); | |
function wphc_modify_orderby_books( $wp_query ) { | |
if ( false === $wp_query->is_main_query() || false === $wp_query->is_post_type_archive( 'books' ) { | |
return; | |
} | |
$wp_query->set( 'orderby', 'title' ); |
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
<?php | |
add_action( 'wp', 'wphc_redirect_url' ); | |
function wphc_redirect_url() { | |
if ( ! is_singular() ) { | |
return; | |
} | |
$redirect = get_post_meta( get_the_ID(), 'redirect_url', true ); |
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
<?php | |
class RK_Term_Swap extends WP_CLI { | |
/** | |
* Swaps one term for another on posts. | |
* | |
* ## OPTIONS | |
* <origin_term> | |
* : The term ID or slug of the term you want to query against, and remove from existing posts | |
* |
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
<?php | |
/** | |
* Excludes child terms from the main query on the category archive. | |
* | |
* @param object $query the WP_Query instance | |
* @return void | |
* @access public | |
*/ | |
function rk_fix_tax_queries_on_archives( $query ) { |
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
<?php | |
add_action( 'admin_init', 'cpt_sticky_add_meta_box' ); | |
add_filter( 'the_posts', 'cpt_sticky_at_top' ); | |
add_filter( 'post_limits', 'fix_post_count', 10, 2 ); | |
function cpt_sticky_meta() { ?> | |
<input id="super-sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky() ); ?> /> <label for="super-sticky" class="selectit"><?php _e( 'Stick this to the top' ) ?></label><?php | |
} |