Site logo

Archived topic

Change Category Links style & position

14 replies · Started by Aaron on January 23, 2018

Viewing posts 1–15 of 15

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

Hi there,

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

Thanks!

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.

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.

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;
}

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

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?

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

Just the commas, please. thanks again.

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.

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.

Great! I learned a lot here. :)

Great to hear! :)

This archived topic is closed to new replies.