Header / footer conditions not applying to post type

Hi there,

I’m trying to apply a custom header / footer to a post type. In my case it is a custom post type called “Event”.

It’s not working. If I go into the settings for a header or footer and add a condition based on Post Type = Event.

But yet if I put a dynamic value into a text box on the post type’s layout it displays “Event”. Also if I change the condition on the header / footer to “Event Status = published” it works. So I’m at a bit of a loss as to why this isn’t working.

It’s working for other custom post types on my site, just not events.

This is the code for my custom post type:

add_action('init', function(){

    register_post_type('event',

        array(

            'labels'      => array(

                'name'          => __( 'Events', 'textdomain' ),

                'singular_name' => __( 'Event', 'textdomain' ),

            ),

            'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),

            'show_ui'      => true,

            'show_in_menu' => true,

            'menu_icon'    => 'dashicons-calendar',

            'public'      => true,

            'has_archive' => true,

            'rewrite'     => array( 'slug' => 'event' ),

            'publicly_queryable' => true,

            'menu_position' => 2,

            'exclude_from_search' => false,

            'show_in_rest' => true

        )

    );

    flush_rewrite_rules();

});

Any ideas what I’m doing wrong?

Thanks!

Hello @Michele27iD,

Thanks for writing in! Do you have any other custom headers? Maybe the priority of the other header is much higher than the custom header that you have assigned for your “Event” custom post type.

And also, go to Cornerstone > Settings > System and hit the “Clear Style Cache” button. If you have a caching plugin, you may need to clear it first as well before testing the site again. If nothing is helping, we would love to check your site. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

You sir are genius, clear style cache has done it, I didn’t know about that function so thanks!!

Glad to hear that, @Michele27iD. The Style Cache will regenerate the code of the builder so it would help if you have issues with the builder’s output.

I thought this was fixed but I am still having problems with anew post type I’ve created.

Can you assist further? Shall I send you some login details?

Hi @Michele27iD,

What is the exact problem you are having now? Is it still with the Header assignment, if so, please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

NOTE: Please mention the Post Type and the specific Header you are trying to assign.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.