Archived topic
Tag archive layout different from blog archive?
6 replies · Started by Michael on August 9, 2021
Facing a strange issue here, and am not sure what is causing it. For my blog archive lists, I've got 3 column layout which I'm very happy with. Recently though I started tagging all the posts and creating a tag index. Strange thing is that when I click a tag it takes me to a single row layout template, which I'll be honest, looks awful. I tried going into customise and layout and it will change some things like excerpt word count but not much else.
Could you take a look? See what might be intefering with it, or how I can match the existing blog layouts 3 columns etc with the tag archive layout.
Much appreciated.
Hi there,
so not all of them are displaying as a Single Column, the ones that are i notice this body class: tax-wpdmtag - and those posts link to single posts of: wpdmpro-template-default
So they're a custom post type which don't use the Blog columns unless told to do so. The PHP Snippet provided here allows you to enable them for CPTs:
One thing i am not sure about though, is why the Single Column Tag archive is displaying them as Align image left. Whereas you default posts are not... any other functions in play for changing the post layout ?
Hi David,
You know the site is that big and complex, it's hard to know what would be the case, I've modified so much over the years. I can certainly investigate why the single column tag archive is aligning left. Probably have custom CSS from an earlier incarnation of that software which was not good for style.
Thank you so much for the snippet, which I'll take a look at. You're right the WPDM supposedly does have it's own default for category archives, but it's not using that either, or most of it. Really appreciate you looking into it, thank you.
I set that to solved too quickly, should've tested. David, I've tried the snippet with various names of the taxonomies for the WP download manager that it uses. It's post type wpdmpro, it's category wpdmcategory and tried wpdmtag there as well, but none set the output to columns.
The reason for the two different outputs is basically if it's a site category it displays in columns, if it's a download category it also displays in columns (controlled by the download manager templates) but when it comes to tags, it seems just to call the theme code for display but bypassing the settings of generatepress. If you look on my main menu now for tags, you'll see I've separated them into site and download tags. The site ones work fine, no issue but the download ones all do this single row layout. There's no template setting in the download manager for outputting tags, just categories.
If I set the category template in the download manager to use the theme, it gives the same layout as it does for tags.
Try this:
add_filter( 'generate_blog_columns', function( $columns ) {
if ( 'wpdmpro' === get_post_type() && ! is_singular() ) {
return true;
}
return $columns;
} );
I assumed the CPT slug is: wpdmpro - which needs to be confirmed and updated in the code above if necessary.
Hi David,
I plugged wpdmpro as the CPT type into the snippet in the link you shared above earlier, but didn't work, your snippet here though does work though, so thank you kindly sir. Can now confirm is displaying in 3 columns. Appreciate your help as always.
Glad to hear that!!