Site logo

Archived topic

Move Tags from below the article next to the author

7 replies · Started by Martin on November 22, 2017

Viewing posts 1–8 of 8

Hi, I want to move tags from below the article next to the author. I'm aware this has to do with actions and filters. And I tried fiddling around with add_action and stuff. However my PHP past is long gone. After spending an hour with it... maybe you have a hint that could speed up my quest ;)

Thanks
Martin

add_action('generate_after_entry_title', 'generate_entry_meta');

...seemed to work. However I'd like to have the tags (and only the tags) right next to the author. I think that might be about writing a new method?

Hi there,

Do you have the author and date enabled below the title?

Hi Tom,
yes, they are both enabled.

Try this:

1. Disable tags in Customize > Layout > Blog.

2. Add this function:

add_filter( 'generate_post_author_output', 'tu_add_tags_to_author' );
function tu_add_tags_to_author( $output ) {
    $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
    $tags = apply_filters( 'generate_tag_list_output', sprintf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
        _x( 'Tags', 'Used before tag names.', 'generatepress' ),
        $tags_list
    ) );

    return $output . $tags;
}

You rock! Thanks a lot :)

added a space in the last line

return $output . " " . $tags;

and set

.links-tags {display:inline;}

Now Date, Author and Tags in the same line.

Thanks again for your quick help. Much appreciated :)

Glad I could help! :)

@Martin, would you mind sending me the URL so I could see the effect? I'm curious and may want to integrate something similar on my site....thanks!

This archived topic is closed to new replies.