Homepage Slider

I’ve forked the latest build from foundation-5 branch as I’m developing a theme to integrate with WooCommerce.

I want to add slider to homepage. I prefer to use the inbuilt feature. What I want to do is to have only the images in slider which I can put in a specific category and show it only on the homepage.

Any thoughts on this?

Hello Arjun,

First of all let me know if you are using rtPanel Child Theme for the development.

Yeah, exactly! I have the child theme which is from the foundation-5 branch.

In rtPanel Child theme, you can use following function to show slider,

if ( function_exists( 'rtp_get_cycle_slider' ) ) {  
	rtp_get_cycle_slider( 5, 200, false, false, true, true );  

Slider code present in /lib/rtp-slideshow.php file, where you will need to add one extra parameter ‘category_name’ => ‘slider’ to fetch images from the specific category, this name will be the category slug.

Your code will look like,
$slider_q = new WP_Query( array( ‘category_name’ => ‘slider’, ‘ignore_sticky_posts’ => 1, ‘posts_per_page’ => $slide_number, ‘order’ => ‘DESC’ ) );

Let me know if its works for you.

This will show images from the recent posts from the cat with slug “slider” right?
I’m trying to put all my slider images in a directory on my server, and those images are to be shown instead of selecting images from a specific category.

Fetching the images from directory to slider would be a cumbersome process, hence I will suggest you to fetch all the attached images of the home page to the slider.

Yeah! I use a static page for the home. Does the rtp_get_cycle_slider function provide possibilities to fetch all the images of that particular page?

rtp_get_cycle_slider function will work in rtPanel Child Theme only. In this function we fetch images using WP_Query, which will not work on a static page.

I will suggest you to create custom home template in your theme, copy your static HTML code to this template, add rtp_get_cycle_slider function with its parameters and assign this template to Home page. Using Reading settings (/wp-admin/options-reading.php) you can set Front Page as Home Page.

Let me know if it works for you.