Site logo

Archived topic

How can I move the tags so they are at the top of the post, below the author?

5 replies · Started by Anne on September 28, 2020

Viewing posts 1–6 of 6

I'd like to change the location of the tags from the bottom of posts to the top of posts, just below the author.

I looked through the settings but didn't notice any option for that.

Is there an easy way to achieve this?

Thanks!

Hi Anne,

You can go to these pages to get references on what codes to use.

https://docs.generatepress.com/article/generate_header_entry_meta_items/
https://docs.generatepress.com/article/entry-meta-style/

You can also follow this topic's solution. It's pretty similar.
https://generatepress.com/forums/topic/change-metadata-order-on-blog-archives/#post-1345450

The solutions are PHP filters. Here's how to add PHP - https://docs.generatepress.com/article/adding-php/

That was a big help thanks. I am using a child theme so i can just add my snippets right to the functions.php which is easy - except the snippet in the topic you linked didnt work for me.

This array does work for me tho:

add_filter( 'generate_header_entry_meta_items', function( $items ) {
    if ( is_single() ) {
        $items = array(
            'author',
            'tags',
        );
    } return $items;
} );

However, it displays the author and tags inline where as id rather the author be its own line. Is this better to achieve with alterting the snippet or just css?

Nevermind i just achieved it using css.

However, the :before css I have styled to the tags at the end of the post isnt being applied to the same tags at the top:

.tags-links:before {
    font-family: inherit;
    content: "Tags:";
    width: auto;
}

It's missing the 'Tags:' Content but thats not really a big deal i guess. Just curious if you can figure out why that is?

Nevermind i just achieved it using css.

Nice one. That's actually the way to go.

However, the :before css I have styled to the tags at the end of the post isnt being applied to the same tags at the top:

.tags-links:before {
    font-family: inherit;
    content: "Tags:";
    width: auto;
}

It’s missing the ‘Tags:’ Content but thats not really a big deal i guess. Just curious if you can figure out why that is?

You'll have to add display:inline-block;. :)

lovely thank you guys again for the support! Solved.

Nice one!

No problem. Always glad to be of any help. :D

This archived topic is closed to new replies.