Archived topic
hide post category, change of blog layout
3 replies · Started by Ewa on November 6, 2021
Hello,
I have two issues:
1. I was able to remove woocommerce category H1 title with such a code:
add_filter('woocommerce_show_page_title', 'bbloomer_hide_cat_page_title');
function bbloomer_hide_cat_page_title($title) {
if( is_product_category( array('templates', 'templates-word' )) ) $title = false;
return $title;
}
I would like to remove in a similar way default post category H1 title. I am tring to use a code:
add_filter( 'get_the_archive_title', 'category_title' );
function category_title( $title ) {
if ( is_category('resume-examples') title(false );
return $title;
}
Unfortunately this code doesn't work. Do you have any idea where do I make a mistake?
2. On a post category I would like to change a layout. I would like to have posts in two rows instead of one row with big featured image. Is there any way to change it?
At the same I would like decrease the featured image size. Is there any option for that?
Hi there,
1. Try this snippet instead:
add_action( 'wp', 'lh_remove_archive_title' );
function lh_remove_archive_title() {
if ( is_category ('resume-examples')){
remove_action( 'generate_archive_title', 'generate_archive_title' );
}
}
2. You can set blog/archive layout to columns in customizer > layout > blog, make sure the blog module is activated at appearance > GeneratePress.
Let me know if you need further assistance :)
The code works perfectly and indeed - I havent's enabled blog module before.
Now all clear.
Thank you very much for your help! :)
You are welcome :)