- This topic has 12 replies, 3 voices, and was last updated 3 years, 6 months ago by Tom.
-
AuthorPosts
-
September 6, 2020 at 11:02 pm #1433424Milos
Hi Tom, I’m also trying to set meta data in one single line, like in this post https://generatepress.com/forums/topic/all-meta-in-one-single-line/, but after adding a snippet it tells me Cannot redeclare function generate_posted_on. Can you help me? Thanks Milos
September 7, 2020 at 1:08 am #1433564DavidStaffCustomer SupportHi there,
that is a really old topic. Maybe this example would be a better place to start:
https://docs.generatepress.com/article/entry-meta-style/#example-1
September 7, 2020 at 1:57 am #1433611MilosThanks David, when I use variant 1, I don’t see the categories in that row and the date at the end, would it be possible to do it as I request?
Date – author – category
September 7, 2020 at 2:15 am #1433624MilosAnd I have one more question. Please, as I turn off the display of categories in the next section – for example, below the image in the archive, it will be enough for me to have everything once using a line, thanks a lot.
September 7, 2020 at 3:02 am #1433682DavidStaffCustomer SupportTry this:
add_filter( 'generate_header_entry_meta_items', function( $items ) { if ( is_single() ) { // Set meta for single post $items = array( 'date', 'author', 'categories', ); } else { // Set meta for archives $items = array( 'date', 'author', ); } return $items; } );
This will set the Meta – Date|Author|Categories for single posts and Date|Author on archives.
September 7, 2020 at 5:05 am #1433785MilosOk, thats good, but how can I remove default location “category”? Now I have it on the web 2x.
September 7, 2020 at 5:31 am #1433802DavidStaffCustomer SupportYou can add this snippet to remove the Categories from the footer meta:
add_filter( 'generate_footer_entry_meta_items', function( $items ) { return array_diff( $items, [ 'categories' ] ); } );
September 7, 2020 at 6:53 am #1433882MilosThanks David, now “archive” is ok, but “single post” has no meta tags, I use this procedure https://generatepress.com/forums/topic/move-author-date-to-the-bottom-after-content / page / 2 / so it is possible that there is a problem. If I turn it on above, it’s fine, but I’d like to have the date of the author, etc. at the end of the post, thanks a lot.
September 7, 2020 at 7:01 am #1433905DavidStaffCustomer SupportJust to be clear.
On the Archive the current layout is correct.
On Single Post you wish to move all the entry meta – Date|Author|Categories to the Footer ?September 7, 2020 at 7:03 am #1433906Milosexactly
September 7, 2020 at 2:14 pm #1434464TomLead DeveloperLead DeveloperHi there,
Isn’t the default for archives “date by author”? Then you can disable the categories by going to Customize > Layout > Blog and un-checking the categories option for single posts.
Then, you should just be able to target single posts like this without the need for any other functions:
add_filter( 'generate_footer_entry_meta_items', function( $items ) { if ( is_single() ) { $items = array( 'date', 'author', 'categories', 'post-navigation', ); } return $items; } );
September 8, 2020 at 11:12 am #1435701MilosNow is everything very nice bautiful 🙂 thanks
September 8, 2020 at 12:38 pm #1435766TomLead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.