Slide Show in Header


#1

Is it possible to put a slide show in the header? What do I need to do? Can you recommend a easy to use (easy to change pics) slide show that will work>


#2

Hi janette,
There are lots of jquery plugins available to put slide show, for example, http://jquery.malsup.com/cycle/.
Please read our developer documentation for understanding hooks that rtPanel provides for customization.
If you want to put the slide show before header, then you need to use rtp_hook_before_header hook.

You can do something like this in functions.php:

add_action(‘rtp_hook_before_header’, ‘your_slider_function’);
function your_slider_function() {
// Your slide show code
}

I would suggest you to install our example child theme for customization. It already has jquery cycle plugin in js folder.
You can download it from here: http://rtpanel.com/docs/developer/#example-child-theme

I hope this will help you, for more information, please read our developer docs.
Thanks.


#3

Hi gogowin,
We have integrated jquery slider plugin with our child theme, you just need to do 2 things in the theme.

  1. Open “lib/rtp-custom-hooks-applied.php” of our child theme and uncomment last 2 lines (45 & 46), written in the rtp_add_scripts() function.

After uncommenting your function code will look like following.

/**

  • Add any custom scripts using this function.
  • @since rtPanelChild 1.0
    */
    function rtp_add_scripts() {
    //wp_enqueue_script( ‘rtp-custom-script’, RTP_CHILD_JS . ‘/js/rtp-custom-script.js’ );
/* Uncomment the following lines if using the jQuery Cycle Plugin for the slider */  
wp_enqueue_script( 'jquery-cycle', RTP_CHILD_JS . '/jquery.cycle.js', array( 'jquery' ), '', true );  
wp_enqueue_script( 'rtp-cycle-slideshow', RTP_CHILD_JS . '/rtp-cycle-slideshow.js', array( 'jquery', 'jquery-cycle' ), '', true );  

}
add_action( ‘wp_enqueue_scripts’, ‘rtp_add_scripts’ );

After this, add following code at the end of this file ( lib/rtp-custom-hooks-applied.php ).

/* Displays slider */
function rtp_child_display_slider() {
echo rtp_get_cycle_slider();
}
add_action( ‘rtp_hook_begin_content’, ‘rtp_child_display_slider’ );

The above code will display slider before content begins. You can change the placement of the slider by changing hook name.
See rtPanel Hooks list here: http://rtpanel.com/docs/developer/

By default, rtp_get_cycle_slider() function will display slider containing 10 latest posts with post title, post image ( if the post has featured image ) and post excerpt.
You may need to modify rtp_get_cycle_slider() function according to your need and style it accordingly.

I hope this will help you. :slight_smile:
Thanks.


#4

Thank you Pradeep, that worked just fine. Really nice slider.


#5

Can you point me to a link with documentaion on getting the jquery slider working. I have installed the rtPanel child theme as well as the rtPanel Hooks plugin and I want activate the jquery cycle plugin that came with the child theme.


#6