Site logo

Archived topic

Featured Image In Category Style Dispatch Theme

3 replies · Started by JOSE on January 13, 2021

Viewing posts 1–4 of 4

I currently use the Dispatch theme.
How could I give the style to the posts header (featured image with the title) to the archives header?
I´d like to show a image with the category´s name.
Thanks

Hi there,

first off you would need this plugin so you can give Categories a featured Images:

https://wordpress.org/plugins/categories-images/

Then you would add this PHP Snippet to your site:

add_filter( 'generate_page_hero_background_image_url', function( $url ) {
    if ( is_category() && function_exists( 'z_taxonomy_image_url' ) ) {
        $image = z_taxonomy_image_url();

        if ( $image ) {
            return $image;
        }
    }

    return $url;
} );

Then any Header Element you set to display on a Category Archive will use your new category featured images.

How could we make it with the new Template content?

This archived topic is closed to new replies.