- This topic has 22 replies, 2 voices, and was last updated 3 years, 10 months ago by Tom.
-
AuthorPosts
-
May 29, 2020 at 9:05 am #1306623TomLead DeveloperLead Developer
That code will display terms in this taxonomy:
genres
If your taxonomy is named
custom_taxonomy_genres
, you’ll have to update theget_the_term_list()
function to reflect that.It’s also assuming you’re in a post type named
pictures
, whether in the archives or single posts.June 1, 2020 at 6:20 pm #1310482MatthewHere is the top section of my Custom post type
function custom_post_type_pictures() { $labels = array( 'name' => _x( 'Pictures', 'Post Type General Name' ), 'singular_name' => _x( 'Picture', 'Post Type Singular Name' ),
Here is the top section of my Custom taxonomy
function custom_taxonomy_genres() { $labels = array( 'name' => _x( 'Genres', 'taxonomy general name' ), 'singular_name' => _x( 'Genre', 'taxonomy singular name' ),
Pls confirm I use
Pictures
andGenres
June 1, 2020 at 6:25 pm #1310491MatthewIf this was a customizer setting it could be,
1) select regular/custom post
2) select category above/below title; or end of post etc
June 2, 2020 at 9:23 am #1311492TomLead DeveloperLead DeveloperThat code targets the
pictures
archive, so the page atyourwebsite.com/pictures
If a genre exists, it will display it above the title, as it is here: https://www.screencast.com/t/C9QVAWy84O
“Science Fiction” is the genre applied to that post.
So the code is working. Perhaps you’re not trying to target the Pictures archive?
Looking through the thread to make sure I’m not missing anything. You said:
What’s still not working is the categories above the title on archives of my CPT.
This does seem to be working now.
Let me know 🙂
June 12, 2020 at 12:43 am #1324625MatthewInteresting, and correct.
How can I also have this work for the home page, which I have been looking at and is probably the source of (my) confusion. Homepage/archives.
If you check out my index.html there is still missing category above title. Can I adjust the code.
thanks,
June 12, 2020 at 10:00 am #1325352TomLead DeveloperLead DeveloperIn that case, you could try replacing:
if ( is_post_type_archive( 'pictures' ) || is_singular( 'pictures' ) ) {
With:
if ( 'pictures' === get_post_type() ) {
June 17, 2020 at 12:57 am #1330889MatthewThanks Tom, functions great now.
A basic question;
I have the home page set to my latest posts under Reading Settings. Does this mean the homepage represents the official (and only) archive page of my regular posts, and if I changed that to a static page what post, page or URL etc would be my regular posts archives?
thanks
June 17, 2020 at 9:23 am #1331593TomLead DeveloperLead DeveloperYour posts page is your “blog”, so it’s your base archive where all of your posts will display.
If you set it to a static page, your “blog” will now appear at that URL (/my-static-page).
-
AuthorPosts
- You must be logged in to reply to this topic.