Archived topic
Can content title be moved with child theme and keep Disable Elements ability
6 replies · Started by Bandara on August 31, 2021
Hello!
In this post I asked about moving my page titles above the page content and the sidebar. I was advised to create a header element, and that worked fine.
The problem is (as was explored in that thread) this solution breaks the "Disable Elements" functionality on individual pages so ticking the "Content Title" under Disable Elements no longer works. The solution I was given was to add an exception to the header element I created for those pages where I didn't want a title.
This is not a workable solution because my editors can't be expected to go into the header element each time and add an exception. especially because there is still a check box in the interface that is now no longer working.
My question is, would it be possible using a child theme to have modified template files where I move the content title and keep the Disable Elements functionality still working? I'm assuming that the disabling isn't just being done with css, otherwise the moved content title would still be able to be disabled using the interface.
Sorry if all that is not clear.
See private note.
Hi there,
can you share a link to a page or post where i can see the layouts ?
Might help with providing a solution.
Special characters such as the & are sanitized from thing like the title for security. EDIT: I tested a topic title with an & and it worked for me... may have been some other characters in place that the server didn't like. We'll do some testing.
Sure!
Ok, so in the example i assume you would want to remove the Header Element when the Content Title is disabled.
If so you could use the generate_element_display filter:
https://docs.generatepress.com/article/generate_element_display/
And in our conditions check that the generate_show_title() is not active eg.
add_filter( 'generate_element_display', function( $display, $element_id ) {
if ( 389 === $element_id && ! generate_show_title() ) {
$display = false;
}
return $display;
}, 10, 2 );
Change the 389 to the ID of the Element.
Amazing!!! Thank you so much!
Glad to be of help!