[Resolved] Bulk change Disable Elements

Home Forums Support [Resolved] Bulk change Disable Elements

Home Forums Support Bulk change Disable Elements

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #323534
    Paul

    Hi

    I realise that I have been inconsistent in Disable Elements settings across my site. There are now hundreds of posts. Is there a way to bulk change so that all posts (they are custom posts) can be given the same Disable Elements settings?

    I know I can achieve some of what I want with CSS but I would really prefer the simpler solution.

    thanks

    #323537
    Leo
    Staff
    Customer Support
    #323596
    Paul

    Hi Leo

    Many thanks for the really quick response.

    I am pretty sure that what you shared would do the trick – but I am not sure how to use the conditional. If I want to hide the site name and logo on every page, would this be correct:

    add_action( 'after_setup_theme','tu_remove_header' );
    function tu_remove_header() {
        remove_action( 'generate_header','generate_construct_header' );
    }

    But I only want to hide it on specific custom post types – sfwd-topic, sfwd-lessons, sfwd-courses (from LearnDash LMS).

    Could you help with the code please.

    best wishes

    Paul

    #323604
    Tom
    Lead Developer
    Lead Developer

    Try this:

    add_action( 'after_setup_theme','tu_remove_header' );
    function tu_remove_header() {
        $post_types = array(
            'sfwd-topic',
            'sfwd-lessons',
            'sfwd-courses'
        );
    
        if ( in_array( get_post_type(), $post_types ) ) {
            remove_action( 'generate_header','generate_construct_header' );
        }
    }
    #323610
    Paul

    Fantastic – works perfectly!

    Thank you so much.

    May I ask one more question. As well as removing the site header, I would like to ensure that the Content Title is always visible – even though I may have Disabled it on a specific post. Is that possible?

    best wishes

    Paul

    #323630
    Tom
    Lead Developer
    Lead Developer

    You could try this:

    add_action( 'wp','tu_always_show_title', 55 );
    function tu_always_show_title() {
        add_filter( 'generate_show_title', '__return_true', 20 );
    }
    #323636
    Paul

    Thanks Tom

    Unfortunately that didn’t work.

    #323711
    Tom
    Lead Developer
    Lead Developer

    I just edited the code above – can you try again?

    #323861
    Paul

    Thanks again Tom – unfortunately the title still doesn’t show.

    I don’t know if this helps – I deactivated GP Premium and the Disable Elements block is still on the Edit Post page but with only one option, Content Title. If this is unchecked, the Title does show. Checked and the title doesn’t show.

    #323997
    Tom
    Lead Developer
    Lead Developer

    Hmm, how are you adding that code?

    #324018
    Paul

    I am placing it into functions.php in gpchild theme (that’s where I put the code to remove the site header too).

    #324025
    Tom
    Lead Developer
    Lead Developer

    Hmm.. Any chance you can send me temporary admin login details with a link to a page where the title should be showing up?: https://generatepress.com/contact/

    #324038
    Paul

    Hi Tom

    I have emailed support@generatepress.com with the login details.

    Paul

    #324247
    Tom
    Lead Developer
    Lead Developer

    Ahh the title is there but still has CSS applied to it.

    Try this:

    .single-sfwd-topic .entry-header {
        display: block;
    }
    #324307
    Paul

    Great – works!

    Thank you very much for investing so much time in helping me Tom.

    Really appreciated.

    best wishes

    Paul

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.