Archived topic
snippet review
11 replies · Started by sg on May 17, 2018
add_filter( 'generate_sidebar_layout','gp_new_prop_layout' );
function gp_new_prop_layout( $layout )
{
if ( is_tax( 'new-prop-category' )) {
//title doesnt hide
add_filter( 'generate_show_title','__return_false' );
return 'no-sidebar';}
// Or else, set the regular layout
return $layout;
}
hi above snippet ,the title is still displaying, any error on this to highlight? thanks
Hi SG, is this a custom taxonomy archive?
yes sir. the hide sidebar works, but not the title. thanks
Hi SG, can you try this:
add_filter( 'generate_show_title','gp_tax_remove_title' );
function gp_tax_remove_title( $title ) {
if ( is_tax( 'new-prop-category' ) ) {
return false;
}
return $title;
}
add_filter( 'generate_sidebar_layout','gp_new_prop_layout' );
function gp_new_prop_layout( $layout ) {
if ( is_tax( 'new-prop-category' )) {
return 'no-sidebar';
}
return $layout;
}
yes. i did try this too. the title doesn hide.
is there anyway to add a css style into the snippets ?
generate_show_title only works on static pages and posts.
is_tax() targets taxonomy archives.
If you want to remove the title on the taxonomy archives, you would need to create a custom loop in your child theme, or use CSS.
'' custom loop in your child theme '' < is this snipets ?
I think the CSS option would be simpler. If you want to link us to the site we can help.
since its custom post tax there is no way to add the css,
let me check .
perhaps i can create special 'page-header' and load the style there.
ok, that works . thanks. solved.
Glad you got it working :)