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 $query = new WP_Query( array( 'posts_per_page' => 100, 'fields' => 'ids' ) ); ?> | |
<?php if ( $query->have_posts() ) : | |
$post_ids = $query->posts; | |
shuffle( $post_ids ); | |
$post_ids = array_splice( $post_ids, 0, 12 ); | |
foreach ( $post_ids as $post_id ) : | |
$post = get_post( $post_id ); | |
setup_postdata( $post ); | |
?> |
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( 'the_content', 'x_add_sharing_to_content_top' ); | |
function x_add_sharing_to_content_top( $content ) { | |
if ( function_exists( 'sharing_display') ) | |
$content = sharing_display() . $content; | |
return $content; | |
} |
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( 'jetpack_mobile_stylesheet', function( $stylesheet, $theme ) { | |
return 'vip/mytheme-mobile'; | |
} ); | |
add_filter( 'jetpack_mobile_template', function ( $template, $theme ) { | |
return 'vip/mytheme-mobile'; | |
// if our mobile theme is a child theme, we should return the parent: | |
// return 'pub/myparenttheme-mobile'; |
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_search_orderby', function( $search_orderby, $query ) { | |
return ''; | |
}, 10, 2 ); |
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
$args = array( | |
'category__in' => $cat_id_for_posts, | |
'meta_query' => array( | |
array( | |
'key' => $custom_field_key_show_in_sidebar, | |
'value' => $custom_field_value_show_in_sidebar, | |
), | |
), | |
); |
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 x_allow_ids_on_tags() { | |
global $allowedposttags; | |
$tags = array( 'section', 'article' ); | |
$new_attributes = array( 'id' => array() ); | |
foreach ( $tags as $tag ) { | |
if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) | |
$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
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 | |
// TODO: don't run if Jetpack is active | |
add_action( 'plugins_loaded', function() { | |
if ( ! file_exists( WP_PLUGIN_DIR . '/jetpack/' ) ) | |
return; | |
$modules = array( | |
'modules/contact-form.php', | |
'modules/shortcodes.php', |
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 | |
// Register our custom rule | |
add_action( 'init', 'qz_add_custom_permalink_rule' ); | |
function qz_add_custom_permalink_rule() { | |
add_rewrite_rule( '/(\d+)/(^/)/' => 'index.php?p=$matches[1]&name=$matches[2]' ); | |
} | |
add_filter( 'post_link', 'qz_custom_permalink', 99, 2 ); |
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
add_filter( 'pre_post_link', 'make__permalink', 10, 2 ); | |
function make_new_permalink( $permalink, $post ) { | |
if ( 'page' == $post->post_type && in_array( $post->page_name, array( 'home-page', 'home-page-include' ) ) ) { | |
$permalink = 'http://makezine.com'; | |
} | |
return $permalink; | |
} |
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_action( 'init', 'x_maintenance_mode' ); | |
function x_maintenance_mode() { | |
if ( defined( 'X_MAINTENANCE_MODE' ) && true === X_MAINTENANCE_MODE ) { | |
if ( is_super_admin() && is_admin() ) | |
return; | |
die( 'Site is currently under maintenance' ); |