Slider on home, other pages to pull featured image.

Community Forums Forums Design Tips and Tricks Slider on home, other pages to pull featured image.

This topic is: resolved

This topic contains 9 replies, has 2 voices, and was last updated by  KarenLeighBurton 10 months, 4 weeks ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #59239

    KarenLeighBurton
    Participant
    Post count: 19

    I am working on a site http://www.readyvillemill.com

    We have an area set at the top of each page that currently displays the “genesis responsive slider”. My client would like the slider itself to only appear on the homepage, but when you visit a page or post the “featured image” from that page (if none assigned then by default display the slider) in that location.

    I’m sure it’s some code that just needs to go into either the functions or the home.php (or both) but I am not a very strong php coder. Can someone help me with this functionality?

    It would be much appreciated.

    Thank you :)

    http://www.readyvillemill.com
    #59251

    Sridhar Katakam
    Participant
    Post count: 987

    Place a file named page.php having this code in agency directory: http://pastebin.com/3cVnBf3V

    That should do it.


    #59260

    KarenLeighBurton
    Participant
    Post count: 19

    Thank you – :)

    That works – but it is still running the slider so it now has the slider on top and the featured image below;

    http://www.readyvillemill.com/about/

    any additional suggestions?

    #59263

    Sridhar Katakam
    Participant
    Post count: 987

    That is strange, it doesn’t work like that in the test site on my localhost. Hopefully someone more experienced can chime in.


    #59265

    KarenLeighBurton
    Participant
    Post count: 19

    nevermind! I think I may have figured it out and fixed it – woohoo!
    Thank you very much.

    #59272

    Sridhar Katakam
    Participant
    Post count: 987

    Can you share the solution for everyone’s benefit?


    #59277

    KarenLeighBurton
    Participant
    Post count: 19

    well I created a special widget area called welcome-text in the theme which was assigned to “all pages/posts/home” etc. I figured out I needed to acutally use the home-slider widget section for the slideshow – once i moved the slideshow there it worked. I did have to apply a div to the featured image so that it just wasn’t left aligned on the top of the page.

    I made this edit to the page.php code;
    <?php

    add_action( 'genesis_after_header', 'agency_home_welcome_helper' );

    function agency_home_welcome_helper() {

    echo '<div id="home-welcome">';
    if (has_post_thumbnail( $post->ID ) ) :
    echo get_the_post_thumbnail($post->ID);
    echo '</div><!-- end #home-welcome -->';

    else :

    if ( is_active_sidebar( 'home-slider' ) ) :
    echo '<div id="home-slider">';
    dynamic_sidebar( 'home-slider' );
    echo '</div><!-- end #home-slider -->';

    endif;

    endif;

    }

    genesis();

    #65031

    KarenLeighBurton
    Participant
    Post count: 19

    Sridhar, Wondering if you know how to do this same thing on an un-modified version of eleven40 (not the pro). I want to use the page-title widget area to display a slider or image on the homepage, but then on all pages/posts pull the featured image – if none revert to the homepage image. I’ve asked, I’ve even tried what you provided above and it’s not working…

    its a development site so no url to publish – Child – Eleven40 vs 1.1 Genesis – vs 2.0.1

    I’ve made no other modifications to this theme at all yet – figured I’d start with this first… Would greatly appreciate if you can help.

    I put this in a page.php template in the theme folder;

    <?php

    add_action( ‘genesis_before_content_sidebar_wrap’, ‘eleven40_page_title’ );

    function eleven40_page_title() {

    if (has_post_thumbnail( $post->ID ) ) :
    echo get_the_post_thumbnail($post->ID);

    else :

    if ( is_active_sidebar( ‘page-title’ ) ) :
    echo ‘<div id=”page-title”>’;
    dynamic_sidebar( ‘page-title’ );
    echo ‘</div><!– end #page-title –>’;

    endif;

    endif;

    }

    genesis();

    #65435

    Sridhar Katakam
    Participant
    Post count: 987
    #65475

    KarenLeighBurton
    Participant
    Post count: 19

    OM Gosh – this is awesome! Thank you so very very much!

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

The topic ‘Slider on home, other pages to pull featured image.’ is closed to new replies.