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

Home Forums Support [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 12 posts - 1 through 12 (of 12 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

    #2544432
    jmarc

    Hello

    This code works fine but I would like this code not to be apply on not on the archive page (homepage), only on the single post.
    Is is possible please ?
    Thank you

    MArc

    #2544484
    Ying
    Staff
    Customer Support

    Hi JMARC,

    So only apply it to the single posts?

    If so, try modifying the code to:

    .single-post .entry-header .cat-links, .entry-header .tags-links {
        display: block;
    }
    #2544515
    jmarc

    Hello Ying and thank you but it doesn’t work πŸ™
    Maybe I should explain again : I only want category and tag below the title but only on single post not on the archive(homepage).
    On the homepage it’s should appear at the bottom.

    MArc

    #2544537
    Ying
    Staff
    Customer Support

    Can you open a new topic and attach the link to a single post?

    let me know πŸ™‚

    #2544544
    jmarc

    Of course I will
    Thank you Ying

    #2544630
    Ying
    Staff
    Customer Support

    No problem πŸ™‚

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