Site logo

Archived topic

Show Taxonomy Categories on Archive instead of posts

5 replies · Started by David on July 1, 2019

Viewing posts 1–6 of 6

Hi there,

It's possible, but you would need to create a custom template and loop the categories instead of the posts. Unfortunately it's quite a bit job, so it's not really something I can provide code for in here.

Thanks Tom, I've got this sorted now.

On the custom taxonomy archive page, what do I need to do to make sure images are cropped to the same size on the category page?

http://185.20.51.60/~markettownmemori/memorialcategories/cemetery-memorials/

I've added this to functions but doesn't seem to work...

add_filter( 'generate_blog_image_attributes','tu_variable_image_sizes' );
function tu_variable_image_sizes( $atts ) {
// Set up our conditional
if ( is_post_type_archive( 'memorialcateogories' ) ) {
$atts[ 'width' ] = 800;
$atts[ 'height' ] = 600;
$atts[ 'crop' ] = true;
}

// Return our options
return $atts;
}

I would do this:

add_action( 'wp', function() {
    add_image_size( 'memorial-categories', 800, 600, true );
} );

add_filter( 'generate_page_header_default_size', function( $size ) {
    if ( is_post_type_archive( 'memorialcategories' ) ) {
        return 'memorial-categories';
    }

    return $size;
} );

You may need to regenerate your thumbnails once you add this code: https://en-ca.wordpress.org/plugins/regenerate-thumbnails/

Thanks Tom

You're welcome :)

This archived topic is closed to new replies.