[Resolved] Tags and Categories added to below the title now messed up

Home Forums Support Tags and Categories added to below the title now messed up

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #982287
    Michael

    Hi,

    Sometime ago, I had added this code to add the categories and tags under the titles on posts:

    add_action( 'generate_after_entry_title', 'tu_add_meta_below_title' );
    function tu_add_meta_below_title() {
        $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
        $categories_list = sprintf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
            _x( 'Categories', 'Used before category names.', 'generatepress' ),
            $categories_list
        );
    
        $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
        $tags_list = sprintf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    		esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ),
    			$tags_list
    	);
    
    	?>
    	<div class="entry-meta">
    		<?php echo $categories_list; ?>
    		<?php echo $tags_list; ?>
    	</div>
    	<?php
    }
    

    After I updated GP, these broke, no longer are seperated by commas, and no longer have their little image with them.

    The attached URL is the site where I’ve updated GP.

    #982484
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The post you linked to only has 1 category and 1 tag, which is likely why there aren’t any commas. Is there a post I can check out that has multiple categories/tags?

    As for the icons, try adding this CSS:

    header.entry-header span.cat-links:before, 
    header.entry-header span.tags-links:before {
        display: inline;
    }

    Let me know 🙂

    #982921
    Michael

    Hi Tom, commas reappeared by themselves…weird…maybe a cache refresh?
    That CSS worked to add the icons back, but the tags and categories used to be on seperate lines like they are in the bottom section. Anyway to get that back?

    Also I editted by first post and included a link to a page that has multiple tages.

    Thanks
    Mike.

    #983200
    David
    Staff
    Customer Support

    Hi there,

    try adding this CSS to stack the links:

    .entry-header .cat-links, .entry-header .tags-links {
        display: block;
    }
    #983304
    Michael

    Thanks man, worked like a charm. Back to its old beautiful self.

    #983310
    David
    Staff
    Customer Support

    Glad we could be of help

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