- This topic has 15 replies, 3 voices, and was last updated 8 years, 10 months ago by
Tom.
-
AuthorPosts
-
May 24, 2017 at 9:35 am #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
May 24, 2017 at 9:44 am #323537Leo
StaffCustomer SupportHi Paul,
This post should help: https://generatepress.com/forums/topic/sections-set-to-disabled-by-default/#post-314143
With some conditional tags: https://codex.wordpress.org/Conditional_Tags#A_Single_Page.2C_a_Single_Post.2C_an_Attachment_or_Any_Other_Custom_Post_Type
Let me know if you need more info.
May 24, 2017 at 11:33 am #323596Paul
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
May 24, 2017 at 11:38 am #323604Tom
Lead DeveloperLead DeveloperTry 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' ); } }May 24, 2017 at 11:46 am #323610Paul
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
May 24, 2017 at 12:16 pm #323630Tom
Lead DeveloperLead DeveloperYou could try this:
add_action( 'wp','tu_always_show_title', 55 ); function tu_always_show_title() { add_filter( 'generate_show_title', '__return_true', 20 ); }May 24, 2017 at 12:28 pm #323636Paul
Thanks Tom
Unfortunately that didn’t work.
May 24, 2017 at 3:31 pm #323711Tom
Lead DeveloperLead DeveloperI just edited the code above – can you try again?
May 25, 2017 at 1:06 am #323861Paul
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.
May 25, 2017 at 9:06 am #323997Tom
Lead DeveloperLead DeveloperHmm, how are you adding that code?
May 25, 2017 at 9:21 am #324018Paul
I am placing it into functions.php in gpchild theme (that’s where I put the code to remove the site header too).
May 25, 2017 at 9:28 am #324025Tom
Lead DeveloperLead DeveloperHmm.. 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/
May 25, 2017 at 9:59 am #324038Paul
May 25, 2017 at 8:37 pm #324247Tom
Lead DeveloperLead DeveloperAhh the title is there but still has CSS applied to it.
Try this:
.single-sfwd-topic .entry-header { display: block; }May 26, 2017 at 1:04 am #324307Paul
Great – works!
Thank you very much for investing so much time in helping me Tom.
Really appreciated.
best wishes
Paul
-
AuthorPosts
- You must be logged in to reply to this topic.