[Resolved] Tag archive page styling

Home Forums Support Tag archive page styling

  • This topic has 3 replies, 2 voices, and was last updated 5 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1412517
    Mark

    I am using the Tag Groups plugin to allow filtering a collection of webinars by using speaker names as tags. Clicking on the speaker name in the “Filter by Speaker” widget in the sidebar opens a tag archive page with all webinars by that speaker.
    The archive page that opens is in a format of Title followed by large Featured Image followed by Excerpt.

    I’m trying to find a way to style this page as more of a standard list look with the Title followed by a thumbnail aligned left of the excerpt. I want to style the tag archive page without affecting any other archive type pages.

    I contacted the plugin developers, but they could only suggest modifying the tag template in a child theme.

    Is there another way to do this within GP, using CSS and/or a PHP code snippet?
    If it helps, Inspect shows this for one of the tag archive pages:
    <body class=”archive tag tag-ari-wilkins tag-361 …….>

    Any suggestions would be appreciated.

    #1412557
    David
    Staff
    Customer Support

    Hi there,

    you can change the Blog options using the option_generate_blog_settings filter

    https://docs.generatepress.com/article/option_generate_blog_settings/

    You just need to change the IF condition to your tag archive and add your options.
    In the example provided you will see this condition ( for the search results ):

    if ( is_search() ) {

    you would change that to:

    if ( is_tag( 'your-tag-archive-slug' ) ) {

    #1413157
    Mark

    Thanks, David! I would have replied sooner, but I’ve been playing with this all day trying to figure it out.

    I had a couple of problems.
    I substituted for ‘your-tag-archive-slug’ with ‘diane-l-richard’ (one of the speaker name tags).
    However, it doesn’t really have much effect unless I also activate this code snippet:

    add_filter( ‘generate_blog_image_attributes’,’mb_variable_image_sizes’ );
    function mb_variable_image_sizes( $atts )
    {
    // Set up the conditional
    if ( is_tag() ):
    $atts[ ‘size’ ] = thumbnail;
    $atts[ ‘align’] = left;
    endif;

    // Return our options
    return $atts;
    }

    Now, the archive page has a thumbnail aligned left of the excerpt, below the title.

    So, this works, but only for the specific tag ‘diane-l-richard’

    I could not figure out a way to combine a series of tags, so just left out reference to a specific tag, so:

    if ( is_tag( )){

    I’m not sure why it requires both snippets – neither gives the desired effect without the other.
    But this combination seems to do what I wanted, so thanks for the input on the option_generate_blog_settings filter.

    If you can spot a cleaner way to do it, please pass it along, but I’ll mark this as Resolved.

    Regards,
    Mark

    #1413730
    David
    Staff
    Customer Support

    If you only have the one filter snippet using:

    if ( is_tag() ) {

    That should apply to all Tag Archives.

    The other specific term one should not be required.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.