Slider on post/single page

  • shubham12u

    #2391

    I’m using static frontpage and homepage panes in my site. So I removed the slider from homepage, because I thought that it is not a good idea to have slider on homepage, as the homepage panes also doing the same job. Later I thought about adding slider on single posts page. Now I added the slider to single posts. Please visit my site and tell me how it looks.. Thanks!

    My site address: http://prasannasp.net

    Single page with slider: http://www.prasannasp.net/how-to-extract-rar-files-in-ubuntu/

    deborah10236

    #20059

    Can you tell me how you did this? Thanks so much.

    Prasanna SP

    #20060

    Add this to your child theme’s functions.php file, (How to modify the theme using a child theme – https://forum.graphene-theme.com/graphene-support/how-to-modify-the-theme-using-a-child-theme )

    <?php
    function graphene_display_slider(){
    graphene_slider();
    add_action('wp_footer', 'graphene_scrollable');
    }
    ?>

    You can restrict the slider to homepage, single post or page like this,

    <?php
    function graphene_display_slider(){
    if (is_single() || is_front_page()){
    graphene_slider();
    add_action('wp_footer', 'graphene_scrollable');
    }
    }
    ?>

    This restricts the slider to front page and single posts only.

    Some other conditional tags are,

    is_page()

    is_home()

    is_archive()

    etc..,

    Manasse

    #20061

    Hmmm. This might come in handy! Can you also choose what (category/posts) the slider shows if the user is on a specific page/category?

    (asking for the same problems over and over again: conditional formatting…)

    Maybe it’s an option that could be implanted in the next Graphene’s update… Then you can choose where to put A slider (instead of the slider) and what the slider is showing there… Hmmm… Customizing to the max!

    chitaranjan

    #20062

    What should I do if I want to add on “Posts Page”, not in Front page?

    I am using front page as welcome page where I would like to have a promotional slider without header, sidebar & footer. And I am using “Posts Page” as my home page.

    Prasanna SP

    #20063

    @chitaranjan

    <?php
    function graphene_display_slider(){
    if (is_page('Page_ID')){
    graphene_slider();
    add_action('wp_footer', 'graphene_scrollable');
    }
    }

    function custom_enqueue_scripts(){
    if ( ! is_admin() ) { // Front-end only
    wp_enqueue_script( 'graphene-jquery-tools' ); // jQuery Tools, required for slider
    }
    }
    add_action( 'wp_enqueue_scripts', 'custom_enqueue_scripts' );
    ?>

    Where Page_ID is the ID of your Posts Page.

    chitaranjan

    #20064

    @Prasana

    Please bare with me, do you mean I need to include this in theme-slider.php?

    chitaranjan

    #20065

    Oh I forgot, you are using a child theme. How can I do without child theme?

    Prasanna SP

    #20066

    No, add this to your child theme’s functions.php file.

    Prasanna BTW.., 🙂

    chitaranjan

    #20067

    @Prasana

    Thank you so much. I have added your child theme and above code, it is working fine exactly how I wanted. I am loving this theme and support you guys are providing.

    Taking this advantage, I would like to ask 2 things.

    1. Display slider images as random images from a category (I have requested here as well https://forum.graphene-theme.com/feature-requests/slider-random-images-from-a-category)

    2. Register a single column widget in front page. (I know this theme has lot of options to register widgets but I am short of idea since I have hidden header, sidebars & post in my website home http://www.kockyn.com. Still I am managing to display one widget which register before “Panes” and hiding those panes, may not be the right way to do).

    Thanks in advance…

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

You must be logged in to reply to this topic.