[Support request] Disable Element Does Not Work on CPT header.

Home Forums Support [Support request] Disable Element Does Not Work on CPT header.

Home Forums Support Disable Element Does Not Work on CPT header.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2299588
    John

    I have this page which displays the archive for a custom post type of tips. Thanks to David’s help I used a block layout element to change the content—brilliant!

    https://www.morganscloud.com/jhhtips/

    But I would also like to change the default content header which comes from the register CPT code. I thought I could do that with a layout element to turn off the content header area but it does not work. I verified I was targeted right by turning the footer off and that worked fine.

    I’m guessing there is some good reason why an element won’t turn off the content header on an archive, and if that’s the case I’m thinking I will just hide the header with CSS and then build my own content header in the already created block layout element.

    But before I do that I just wanted to check in and see if, once again, I’m making this harder than it needs to be?

    Thanks

    #2299646
    David
    Staff
    Customer Support

    Hi there,

    the post type archive headers have their own special place that are not currently covered in the Disable Elements.
    But you can use this PHP Snippet to unhook the title. Just change the my_custom_post_type slug to your CPTs:

    add_action('wp', function(){
        if ( is_post_type_archive( 'my_custom_post_type' ) ) {
            remove_action( 'generate_archive_title', 'generate_archive_title' );
        }
    });
    #2299959
    John

    Thanks David,

    Way better than my proposed CSS kluge.

    #2299985
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.