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_action('pre_get_posts', 'only_parent_category'); | |
function only_parent_category( $query ){ | |
if ( is_admin() || ! $query -> is_main_query() || ! is_category() ) | |
return; | |
$query->set('category__and', get_queried_object_id()); | |
//or with the same effect | |
//$query->set('category__in', get_queried_object_id()); | |
//see https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters | |
} |
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_shortcode('do_fp', 'do_fpu'); | |
function do_fpu(){ | |
add_filter('tc_show_fp', '__return_true'); | |
ob_start(); | |
do_action('custom_fpu_hook'); | |
$html = ob_get_contents(); | |
ob_end_clean(); | |
return $html; | |
} |
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('tc_smoothscroll_options', 'my_smoothscroll_options'); | |
function my_smoothscroll_options( $params ){ | |
/* Regulate the scroll step above, default is 150 */ | |
$params['stepSize'] = 60; | |
/* Regulate the animation time with the param above, default is 400 */ | |
// $params['animationTime'] = 600; | |
return $params; | |
} |
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( 'tc_default_widgets' , 'add_fw_home_widget' ); | |
function add_fw_home_widget( $defaults ) { | |
$defaults['fw_widgets_home'] = array( | |
'name' => __( 'Full width widget area' , 'customizr' ), | |
'description' => __( 'Above the featured pages area in home' , 'customizr' ) | |
); | |
return $defaults; | |
} | |
add_action('__after_header', 'display_fw_widget_home', 12); | |
function display_fw_widget_home(){ |
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
//Wrap single post contents | |
add_action('__before_article', 'my_wrapper_start', 0); | |
function my_wrapper_start(){ | |
if ( ! is_single() ) return; | |
echo '<div id="my_article_wrapper" class="article-wrapper">'; | |
} | |
add_action('__after_article_container', 'my_wrapper_end', 0); | |
function my_wrapper_end(){ | |
if ( ! is_single() ) return; | |
echo '</div>'; |
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
// define our widget area | |
add_filter( 'tc_default_widgets' , 'add_featured_page_widget' ); | |
function add_featured_page_widget( $defaults ) { | |
$defaults['mobile_widgets_home'] = array( | |
'name' => __( 'Mobile widget area' , 'customizr' ), | |
'description' => __( 'Above the featured pages area on home in mobiles only' , 'customizr' ) | |
); | |
return $defaults; | |
} | |
// display it before the featured pages in home only for mobiles |