- This topic has 16 replies, 3 voices, and was last updated 4 years, 11 months ago by Tom.
-
AuthorPosts
-
May 26, 2019 at 4:30 pm #911588Allison
Hey,
So I’m working on a site that has some custom post types setup via a plugin (past developer work). I’m looking to set some custom headers via elements for the custom post type category archive page but it won’t let me. It works fine for a custom post type single post but not the category archive page. I set the location to Resource Category and then selected the category name and it won’t work.
Any suggestions?
Thanks,
Allison
May 26, 2019 at 6:16 pm #911608LeoStaffCustomer SupportHi there,
Can you try this filter:
https://docs.generatepress.com/article/generate_header_element_display/With this conditional tag?
https://codex.wordpress.org/Conditional_Tags#A_Post_Type_ArchiveLet me know if this helps π
May 27, 2019 at 9:30 am #912328AllisonI applied the filter and tag and it removed the header from showing on a single custom post type but still nothing is showing on the custom post type category page.
May 27, 2019 at 10:06 am #912380LeoStaffCustomer SupportCan you link me to the page where you want the header element to show?
May 27, 2019 at 10:33 am #912411AllisonI edited my initial post to include the URL, please be careful not to post it anywhere as it’s sensitive information for a client site I’m working on. Resource Categories: Guides, Webcasts
Custom post type: Events are the ones I am having trouble with.May 27, 2019 at 1:14 pm #912543LeoStaffCustomer SupportThe site requires a password to view. Can you provide it?
You can send the dashboard access using Account Issue here:
https://generatepress.com/contact/Please include the following information:
β The URL of this topic.
β Login URL.
β Username and password.May 27, 2019 at 4:03 pm #912637AllisonHi Leo,
I sent the information you require via the account issue contact form. Let me know when you are finished as I’ll have to delete that user account afterwards.
May 28, 2019 at 8:50 am #913484LeoStaffCustomer SupportWhat is the code you’ve tried?
What about this?
add_filter( 'generate_header_element_display', function( $display, $element_id ) { if ( 10 === $element_id && is_tax( 'qsc_resource_category' ) ) { $display = true; } return $display; }, 10, 2 );
Make sure to replace
10
with the actual ID.May 28, 2019 at 3:38 pm #913788TomLead DeveloperLead DeveloperWhile a filter like that should work, it shouldn’t be necessary. The Display Rules should work with custom post types as long as they’re set up correctly.
Can you share a screenshot of your Display Rules?
May 28, 2019 at 4:09 pm #913821AllisonHi Tom,
Here is a sceenshot for the display rules for the custom post type category Guides. The page hero won’t show up.
May 29, 2019 at 8:09 am #914473TomLead DeveloperLead DeveloperSo that will apply to posts inside that category.
Try “Resource Category Archive”.
May 29, 2019 at 11:54 am #914687AllisonDoesn’t work, I even tried making my own custom post type archive and it still won’t work. Screenshot of settings
May 29, 2019 at 3:20 pm #914823TomLead DeveloperLead DeveloperHmm, what happens if you create a Hook Element using a test hook (
before_header
) with the same Display Rules? Does it display?May 29, 2019 at 3:49 pm #914844AllisonThe hook works, just tested it with some words
May 29, 2019 at 4:01 pm #914853TomLead DeveloperLead DeveloperGood news.
Any other Header Elements on the site? If so, can you set them to “Draft” temporarily to see if one of them is conflicting?: https://docs.generatepress.com/article/conflicting-display-rules/
-
AuthorPosts
- You must be logged in to reply to this topic.