Only Display Title-Page Area (Slider) on Home Page or Front Page

Community Forums Forums Design Tips and Tricks Only Display Title-Page Area (Slider) on Home Page or Front Page

This topic is: not resolved

This topic contains 5 replies, has 2 voices, and was last updated by  Sridhar Katakam 10 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #60285

    phill.jasmith
    Participant
    Post count: 2

    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
    Phill

    #60348

    Sridhar Katakam
    Participant
    Post count: 923

    I 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.


    #60362

    phill.jasmith
    Participant
    Post count: 2

    Hi 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

    #60371

    Sridhar Katakam
    Participant
    Post count: 923

    Try 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">',
    		) );
    	}
    }

    #60438

    phill.jasmith
    Participant
    Post count: 2

    Awesome 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 used if(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!
    Phill

    #60849

    Sridhar Katakam
    Participant
    Post count: 923

    does it matter that you put the if statement inside the function itself?

    In my experience, yes.


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.