Community Forums › Forums › Archived Forums › Design Tips and Tricks › Only Display Title-Page Area (Slider) on Home Page or Front Page
Tagged: frontpage, homepage, if(is_front_page()), if(is_home()), slider
- This topic has 5 replies, 2 voices, and was last updated 11 years, 3 months ago by Sridhar Katakam.
-
AuthorPosts
-
September 2, 2013 at 1:22 pm #60285phill.jasmithMember
Hi,
I'm having trouble removing the genesis responsive slider widget area.
I would like to remove the slider from all the pages except for the front page.I've done this so for by creating a custom template for all pages but now I am adding WooCommerce functionality and the option to select my custom template is not there, so now the products have the slider.
I've tried to do a if (is_front_page()) in my functions.. see below:
---if (is_front_page()) {
} else {
remove_action( 'genesis_before_content_sidebar_wrap', 'eleven40_page_title' );
};
---But this removes the slider completely from everywhere on the site and for some reason it also removes it from the front page.
I've also tried the same thing with if (is_home()) and it produced the same result.The reason I leaned more towards the if (is_front_page()) is because the front page is static.
Any help with this would be awesome!
Thanks
PhillSeptember 2, 2013 at 10:13 pm #60348Sridhar KatakamParticipantI activated this theme on my test site, went to Appearance -> Widgets and do not see any widget area for slider. Is that something you have added via functions.php?
Also, looking at the demo site http://demo.studiopress.com/eleven40/ I see no slider.
September 3, 2013 at 12:10 am #60362phill.jasmithMemberHi Sridhar,
Thank you, no I don't add this sidebar, I think you may have download the newer eleven40Pro theme, I think that one doesn't have the "page title" widget area. I'm using the original eleven40 theme which I believe is still available for download. I did customize the theme through css but I did not add any sidebar widget areas myself.
The slider I'm using is the genesis-responsive-slider.
Thanks Sridhar, any help is much appreciated!
Phill
September 3, 2013 at 12:58 am #60371Sridhar KatakamParticipantTry this:
In functions.php, change
/** Add the page title section */ add_action( 'genesis_before_content_sidebar_wrap', 'eleven40_page_title' ); function eleven40_page_title() { genesis_widget_area( 'page-title', array( 'before' => '<div class="page-title widget-area">', ) ); }
to
/** Add the page title section */ add_action( 'genesis_before_content_sidebar_wrap', 'eleven40_page_title' ); function eleven40_page_title() { if(is_home() || is_front_page()) { genesis_widget_area( 'page-title', array( 'before' => '<div class="page-title widget-area">', ) ); } }
September 3, 2013 at 9:36 am #60438phill.jasmithMemberAwesome Sridhar, it worked!
Thanks man!
Sridhar, as a point of interest, why did this work and not when I did them individually?
I used
if(is_home())
and I usedif(is_front_page())
individually with not luck.Here are my if statements that did not work.
if(is_home()){ /** Add the page title section*/ add_action( 'genesis_before_content_sidebar_wrap', 'eleven40_page_title' ); function eleven40_page_title() { genesis_widget_area( 'page-title', array( 'before' => '<div class="page-title widget-area">', ) ); } }
and here's the other one:
if(is_front_page()){ /** Add the page title section*/ add_action( 'genesis_before_content_sidebar_wrap', 'eleven40_page_title' ); function eleven40_page_title() { genesis_widget_area( 'page-title', array( 'before' => '<div class="page-title widget-area">', ) ); } }
Both of these did not work individually, does it matter that you put the if statement inside the function itself?
Thank for the help Sridhar,
Cheers!
PhillSeptember 5, 2013 at 9:30 am #60849Sridhar KatakamParticipantdoes it matter that you put the if statement inside the function itself?
In my experience, yes.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.