Archived topic
Issues with custom foot widgets
1 reply · Started by Thomas on January 19, 2018
For some reason, the code below is not working for me.
Im trying to set
cpt1 = 3 widgets (working)
blog single pages = 3 (not working)
default = 0 (working)
add_filter( 'generate_footer_widgets','tu_custom_blog_footer_widgets' );
function tu_custom_blog_footer_widgets( $widgets )
{
// If we are on the blog, set the number
if ( is_singular( 'cpt1' ) )
return '3';
if ( is_singular( 'post' ) )
return '3';
// Or else, set the regular number
return $widgets;
}
Hi there,
Blog single posts would be is_single: https://docs.generatepress.com/article/using-hooks-conditional-tags/#single-posts