GeneratePress: Custom Category Pages

Manuel Campos

GeneratePress is a versatile and lightweight theme that empowers users to create websites that are both visually appealing and highly functional.

You can craft captivating category pages using the GeneratePress theme and GenerateBlocks or any other Blocks plugin.

A category page serves as a gateway to a curated collection of posts, providing visitors with an organized browsing experience.

This is the best way to customize category pages with GeneratePress

GeneratePress: Custom Category Pages #1

Method #1 is my favorite method to customize the category pages, the method consists of using pages instead of customizing the default category pages.

To do that, you create your categories and a page for each category you create and make sure that the default category links and the custom category page links are the same.

For example:

Then we have to point the default category page links point to the custom category pages using a simple code snippet:

//Pages instead of native category pages
add_filter('request', function( array $query_vars ) {
    if ( is_admin() ) {
        return $query_vars;

    if ( isset( $query_vars['category_name'] ) ) {
        $pagename = $query_vars['category_name'];

        $query_vars = array( 'pagename' => "$pagename" );

    return $query_vars;
} );

Then feel free to customize the custom category pages any way you want.

I’m currently using static pages with query loops to show the post under specific categories instead of using the default archive pages.

If you don’t want to mix pages with custom category pages, consider creating a custom post type for your custom category pages.

GeneratePress: Custom Category Pages #2

To do this, you would create a separate Block Element – Loop Template for each term using GP elements

1. Appearance > Elements -> Add New –> Block Element.
2. Select the Element Type -> Loop Template
3. Set the Display Rules -> Location –> Category Archive —> The Specific Term.
4. In the editor you can now add your content.
4.1 The content should include a GB Query Loop Block that you can set to Inherit Query from Template or set the Params manually to match your term.
5. Publish that.
6. Repeat the above for every term.

If you use this method, the edition of your category pages will take place within the GP elements.

I don’t really like method #2 since it can turn the element section into a mess when you have lots of categories.

Manuel Campos, English Professor

Manuel Campos

I am José Manuel. I am writing about things I know and things that I am learning about WordPress. I hope you find the content of this blog useful.






© 2024 WP SURFER • Made with Love in Costa Rica