- This topic has 13 replies, 3 voices, and was last updated 3 years, 7 months ago by Leo.
-
AuthorPosts
-
September 24, 2020 at 4:54 pm #1457747maxime
Hello,
I customized my entry meta thanks to the documentation and some forum topics, however I couldn’t find one answer.
If one article is present in 2 categories, for example, a post that is in categories WordPress and GeneratePress but the main one is WordPress.
In the entry meta how can I make the main one to appear first ?
The code I have right now is the following:
add_filter( 'generate_header_entry_meta_items', function() { return array( 'date', 'categories', ); } ); add_filter( 'generate_footer_entry_meta_items', '__return_false' );
Thank you for your help
September 24, 2020 at 5:22 pm #1457763LeoStaffCustomer SupportHi there,
Are you referring to parent/child categories here?
September 24, 2020 at 5:27 pm #1457765maximeHello Leo,
In Gutenberg editor on the right sidebar you can choose categories and if you chose more than 1 you have to “Select the primary category”
I don’t know if that would be consider as parent/child or not.
September 24, 2020 at 5:32 pm #1457771LeoStaffCustomer Supportif you chose more than 1 you have to “Select the primary category”
I don’t believe that’s a default option.
Are you using any SEO plugin?
September 24, 2020 at 5:41 pm #1457773maximeOh okay, yes I do, Yoast SEO
September 24, 2020 at 6:37 pm #1457786LeoStaffCustomer SupportIs the primary category always show last? or it’s random sometimes?
Can you link me to the page in question?
September 24, 2020 at 6:48 pm #1457787maximeLooks like there’s a fix order. I just started doing it for the last post, but I added categories here and there in the following posts for you to have more example.
September 25, 2020 at 5:12 am #1458321DavidStaffCustomer SupportHi there,
thats a tricky one.
By default the category terms are output in abc order.
To move the Yoast Primary category to the top of the list would require custom development i am afraid.September 25, 2020 at 7:03 am #1458444maximeOkay I understand.
No problem it was just a question that popped up in my mind when I realized this.
But nothing to worry about so I’ll let it that way.
Thank you David and Leo
September 25, 2020 at 7:40 am #1458494DavidStaffCustomer SupportNo problems – sorry we couldn’t be of more help.
September 25, 2020 at 8:02 am #1458670maximeActually, I thought of something. At least to add tags if I can. So the main category would be WordPress for example and there would be a tag next to it and that would be GeneratePress.
In the code in my first message, how can I add tags right after the categories please ?
Would it be ‘tags’, ?
I’ll try this and see how it works. If it doesn’t don’t worry it wasn’t that big of a deal 🙂
September 25, 2020 at 8:40 am #1458749LeoStaffCustomer SupportThat’s correct 🙂
add_filter( 'generate_header_entry_meta_items', function() { return array( 'date', 'categories', 'tags', ); } ); add_filter( 'generate_footer_entry_meta_items', '__return_false' );
September 25, 2020 at 8:43 am #1458753maximePerfect, thank you for your help 🙂
September 25, 2020 at 8:46 am #1458759LeoStaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.