Archived topic
Entry Meta Author
6 replies · Started by Ian on December 6, 2018
How can I move the author directly below and grouped with the other meta as shown in the screenshot. Author would be below the category.
I would also like to add the word, Category: (before the taxonomy)
The word, Tagged: (before the tab)
The word, Previous Post: (before the next post meta)
The word, Next Post: (after the next post meta)
Hi there,
You can add the author below the category like this:
add_filter( 'generate_post_author', '__return_false' );
add_filter( 'generate_category_list_output', function( $output ) {
echo $output;
printf( ' <span class="byline">%1$s</span>', // WPCS: XSS ok, sanitization ok.
sprintf( '<span class="author vcard" %5$s>%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
__( 'by', 'generatepress' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
/* translators: 1: Author name */
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() ),
generate_get_microdata( 'post-author' )
)
);
} );
The others are possible as well but it's not possible to add the words before the icons. It would be easiest to replace the icons with the text if that works for you?
Getting the following error and when I copy your code it looks like I can't copy the bottom line?
The code snippet you are trying to save produced a fatal error on line 14:
syntax error, unexpected ')'
Copied the code but tells me it's missing a bracket.
Sorry about that! Can you try now?
That did the trick, thanks.
You're welcome :)