Archived topic
Move Author, Date to the bottom - after content.
29 replies · Started by Ramesh Srinivasan on February 4, 2016
GP can only control code added by itself - it can't control text you've added manually into the post.
Hello Tom,
I think I have been confusing in what I am asking for by manually adding the Author and Date in the post or I miss understand what the PHP code is doing
Here is an unstyled post that might be clearer
http://aaa.greaterthanthesum.com/types-trust-networks/
Here is what I want to do
https://nimbus.everhelper.me/client/notes/share/719865/9gurmklveg8af9f4nqs9
https://nimbus.everhelper.me/client/notes/share/719882/skg1nkun65qaxmfvqkvw
Is this what the PHP code does? If so it is not working
Thanks
That un-styled post helps.
So, this function is currently active on your website?: https://gist.github.com/generatepress/cf95fae85d5e7773d97a
How are you adding it?
My fault, did not realize I had to activate "Code Snippet" snippet, it's working now
Thanks
You're welcome :)
Hi Tom, when i want to activate this code, i see this message:
Cannot redeclare function generate_entry_meta.
I use this code https://gist.github.com/generatepress/cf95fae85d5e7773d97a
Can you help me? Thanks
Hi there,
There's an easier way to do it now:
add_filter( 'generate_header_entry_meta_items', '__return_empty_array' );
add_filter( 'generate_footer_entry_meta_items', function( $items ) {
return array(
'date',
'author',
'categories',
'tags',
'comments-link',
'post-navigation',
);
} );
Let me know :)
Thanks Tom. When I activate this code, meta data are in the bottom - thats ok, but in header under title I have an error:
Warning: Invalid argument supplied for foreach() in ...wp-content/themes/generatepress/inc/structure/post-meta.php on line 279
Hi there,
Can you try the updated code?: https://generatepress.com/forums/topic/move-author-date-to-the-bottom-after-content/page/2/#post-1166355
Let me know :)
Hi Tom, now it is better, but the date and author is not in the line, can you fix it?
And second problem, after I activate this code, on archive post date and author is missing :( Its possible make changes only on post page and let the others as it was?
Can you link me to the post where they're not in line?
For the second question, try updating the code to this:
add_action( 'wp', function() {
if ( is_single() ) {
add_filter( 'generate_header_entry_meta_items', '__return_empty_array' );
add_filter( 'generate_footer_entry_meta_items', function( $items ) {
return array(
'date',
'author',
'categories',
'tags',
'comments-link',
'post-navigation',
);
} );
}
} );
For example in this article: https://www.autovylet.cz/dovolena-v-polsku-u-baltskeho-more/
Try this CSS:
footer.entry-meta .byline,
footer.entry-meta .posted-on {
display: inline-block;
}
Now its ok, thanks.
You're welcome :)