Archived topic
How to categorise my home page hero
4 replies · Started by Lokeish on December 8, 2022
Hi,
I am a new customer and I loved the theme. I am wondering how to categorise my home page. All I could see is the same articles (current posts). Please help me how to do that. I tried dynamic data but still i am not able to do this. I need featured image and heading to my selected.tags/categories
Hi Lokesh,
You can try adding this snippet:
function generate_home_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'category-name', 'affiliate-marketing, uncategorized' );
}
}
add_action( 'pre_get_posts', 'generate_home_category' );
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
Replace affiliate-marketing and uncategorized with your categories.
This will show posts only from those categories. With your current structure, the images and titles are already showing.
If you're referring to something else, let us know.
Hi there,
please reply in the topic not too any email notifications this will help you and us keep track of your requests.
please raise a new topic for new unrelated questions.
Thank you.
You're welcome