Site logo

Archived topic

Homepage/ Archive Customization

20 replies · Started by Rohan Verma on July 4, 2022

Viewing posts 16–21 of 21

We are also using WPSP to show related posts after each articles

I see. You may also set what categories will appear in your blog page. For instance, this PHP snippet will do that:

function set_categories_in_home_query( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
		$query->set( 'tax_query', array(
            array(
                'taxonomy' => 'category',
                'field' => 'slug',
                'terms' => array('affiliate-marketing'),
            ) ) );
		
    }
}
add_action( 'pre_get_posts', 'set_categories_in_home_query' );

Modify affiliate-marketing with your category slug.

Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

Looking at your site, it seems you were already able to achieve the look you’re going for.

To clarify would you need further assistance with regards to this?

Kindly let us know.

Can I use generate blocks with Classic editor? I mean, I will create the homepage with generating blocks (using block editor) and then continue with the classic editor

No, you can’t. You would need to use the default WordPress Block Editor, which is what we would advice as well.

Hope this clarifies!

Okay thanks for your help :)

You’re welcome Rohan!

This archived topic is closed to new replies.