Site logo

Archived topic

Changing the layout of the elements of a post

3 replies · Started by Patrick on December 3, 2021

Viewing posts 1–4 of 4

Hi there,

sorry for the delay, you're topic slipped through our system.
Try this PHP snippet:

add_action( 'wp', function(){
    if ( in_category( 'category_slug' ) ) {
        remove_action( 'generate_after_entry_title','generate_post_meta', 10 );
        remove_action( 'generate_after_entry_content','generate_footer_meta', 10 );
    }
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Just update the category_slug to match your requirements.

Thank you,
It's ok for my first steps, I figured it out by myself without writing any code. I went to an article and launched the customization. In this one I found Layout / Blog / Articles and I was able to uncheck what did not suit me.

Now, I want to understand your proposition:
Is the add action(){} to put in child theme/functions.php? It's what I understand from "Adding PHP: https://docs.generatepress.com/article/adding-php/"

And after ? Just update category_slug ? I go to posts categories and I select the category then "enter"

Hi Patrick,

1. Yes, copy and paste the code to your child theme's functions.php file.

2. Find out what the slug of the specific category is, replace the category_slug with it.

3. Save your functions.phpfile.

Let me know if this helps :)

This archived topic is closed to new replies.