[Resolved] Change Category Links style & position

Home Forums Support [Resolved] Change Category Links style & position

Home Forums Support Change Category Links style & position

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #477845
    Aaron

    Hello People,
    firstly I want to thank you for your great theme.
    I have a question about: .cat-link
    is it possible that the category will appear the same as the tags look like, for some reason my category looks like a list (ul), and I can’t change it?
    and how to move the .cat-links to appear below the post title?
    image: https://myherb.co.il/wp-content/uploads/2018/01/myherb-category-fix.jpg

    Thanks,
    Aaron

    #478076
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not quite sure what you mean. Are you able to guide me to the page in question?

    Thanks!

    #478715
    Aaron

    Hi Leo,
    I’m sorry for my English.
    here is the link:
    link to the page
    1. Take a look at the post categories, they appear at the end of the article, I want to move them up, so they will be below the title (above the featured image).
    2. Categories show up with bullets for some reason, is it possible to make them show up like the tags look like (take a look at the link I provided).

    Thanks.

    #478912
    Leo
    Staff
    Customer Support

    1. https://generatepress.com/forums/topic/display-post-categories-and-tags-below-title/#post-443405

    2. Can you disable any caching plugin so I can see the source of the code?

    #480003
    Aaron

    1. Thank you, Leo that’s worked. but there is a problem, the commas “,” between cat & tags appear again, is it possible to remove them?.
    also, the tags and categories appear at two places at the same time (need to remove them from the end of the post).

    2. Plugin Disabled.

    #480156
    Tom
    Lead Developer
    Lead Developer

    To remove the commas, you would replace that function with this one:

    add_action( 'generate_after_entry_title', 'tu_add_meta_below_title' );
    function tu_add_meta_below_title() {
        $categories_list = get_the_category_list( '' );
        $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( '', '' );
        $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
        );
    
        if ( $tags_list || $categories_list ) :
    	?>
    	<div class="entry-meta">
                <?php 
                if ( $categories_list ) {
                    echo $categories_list;
                }
    
                if ( $tags_list ) {
                    echo $tags_list;
                }
                ?>
    	</div>
    	<?php
        endif;
    }
    #480302
    Aaron

    Hi Tom, thanks for your answer. This code removed the comma, and moved the taxonomies up, but – categories shows as a list item: link

    + at the end of the article you can see category and tags appear with commas: link to the article

    #480628
    Tom
    Lead Developer
    Lead Developer

    Try adding this CSS:

    .entry-meta .post-categories li,
    .entry-meta .post-categories {
        display: inline;
    }

    Do you want that post meta at the bottom as well?

    #481147
    Aaron

    It’s Working great, Thanks Tom!
    – the last weird problem: it keeps show taxonomy with a comma at the end of the article</a

    #481242
    Tom
    Lead Developer
    Lead Developer

    Do you want those tags to show up there as well, just without the commas? Or do you want them to go away completely?

    #481299
    Aaron

    Just the commas, please. thanks again.

    #481307
    Aaron

    How to target specific custom post type , to remove this icon of tags, which is showing up empty without taxonomies. maybe because it has different slug, maybe not.

    #481500
    Tom
    Lead Developer
    Lead Developer

    The best thing to do would be to turn them off by default in Customize > Layout > Blog, then add this line of code:

    add_action( 'generate_after_entry_content', 'tu_add_meta_below_title' );

    I just adjusted the code above so the elements should only display if they exist.

    #482290
    Aaron

    Great! I learned a lot here. ๐Ÿ™‚

    #482728
    Tom
    Lead Developer
    Lead Developer

    Great to hear! ๐Ÿ™‚

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