Archived topic
Generate Section Sidebars while excluding the home page
30 replies · Started by David on June 30, 2017
Hi Tom and Leo,
I want to use the filter below for posts but I don't want it to filter the homepage.
add_filter( 'generate_sections_sidebars','__return_true' );
What is the best way to do this? Thanks!
Hi there,
Give this a shot:
add_filter( 'generate_sections_sidebars','lh_generate_sections_sidebars' );
function lh_generate_sections_sidebars() {
if ( is_front_page() ) {
return false;
}
return true;
}
If your home page is the blog page then try is_home() instead
Let me know.
Excellent. That worked great but the page header content is not appearing.
You can review here:
http://cmcwebdev.com/ilm/00001jf-jonathan-franks/
Thanks!
That's weird. Not sure why it would do that.
I was able to use the code and get the page header show up in post as well.
So there is content in the page header metabox of that post and when you remove/deactivate the code it comes back again?
Just want to make sure nothing is disabled here as well: https://docs.generatepress.com/article/disable-elements-overview/
Checking now. Yeah, it's very weird. One moment.
Status Update
Disabled Elements = nothing is checked there.
I created a new Post and the same result. Page header is not appearing.
Hmmmmmmm?
And as soon as you deactivate the snippet the page header displays again?
Deactivated the snippet and the page header doesn't display again.
Hmm I really think this is causing by something else...
Just tested it a couple times and couldn't reproduce the issue.
What do you have in the page header meta box? I can't see it being loaded in the source code either.
Here is what I have in the content area:
<p><img src="http://cmcwebdev.com/ilm/wp-content/uploads/2017/06/profile-picture-150x150.jpg" alt="" width="150" height="150" class="aligncenter size-thumbnail wp-image-405 round-image" /></p>
<p style="text-align: center;"><strong>Jonathan Franks</strong><br>
1/10/1957 - 6/19/2015<br>
Atlanta, Georgia</p>
<div style="text-align: center;"><a class="button small">Donate</a> <a class="button small">Send Flowers</a></div>
I did another test by selecting "Advanced" and the Page Header appears. You can review it here:
http://cmcwebdev.com/ilm/00001jf-jonathan-franks/
I'm seeing the page header content there - is it not working on a different page?
I just created this test page for review. Still not showing up.
http://cmcwebdev.com/ilm/test-post/
I have done these task to troubleshoot:
1. Removed Customize CSS. No Change.
2. Created a new post with content. No Change.
3. Disabled "Disable Elements". No Change.
4. Deactivated and Reactivate Page Headers. No Change.
5. Deactivated and Reactivate Sections. No Change.
6. Disabled the snippet. No Change.
This one has me stumped. Since the Page Header was working prior to adding the snippet for the side bars to appear in Sections.
Quick question. If I switch the Theme to the default Wordpress Theme, will I lose my Customizer settings?
Nope you won't!
Testing that next. Stay tuned.