Most of the themes from Elegant Themes have a featured slider on home page. You may need a specific order of slides in the featured slider for several reasons. For instance, you may want to create a slide show using the slides.
The method to change the order of slides in the featured slider depends upon whether you are using pages or posts in the slider.
If you are using pages in the slider, then you can order them using the Page Order field. You can find the Page Order field under the Page Attributes.
Set a Page Order value for each page in the slider, and they will be ordered by this value.
If you are using posts in the slider, you can order them by editing their posted date. The posts are ordered by date by default, with the most recent post displayed first.
If you need more control over the order of slides, when using posts or pages as slides, you should edit the featured slider’s query.
For pages, you need to edit this code in includes/featured.php,
('post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'post__in' => get_option('nova_feat_pages'),
'showposts' => $featured_num)
);
And for posts, you need to edit this code in includes/featured.php,
Now you can edit the orderby and order parameters in this code to arrange the slides in any order you want.
The order parameter can have two values, ASC and DESC, to display the posts in ascending and descending order respectively for the orderby parameter.
There are various orderby parameters as described in the “Order & Orderby Parameters” section here. The parameters useful for us to order the slides are, id, title, date, modified, rand, meta_value and meta_value_num.
- id sorts the posts in the order of post ids.
- title sorts the posts in the order of post titles.
- date sorts the posts in the order of the date on which the post was published.
- modified sorts the posts in the order of the date on which the post was last modified.
- rand parameter shows the posts in random order every time the slider is loaded.
- meta_value shows the posts in alphabetical order with respect to a custom field key that we define.
- meta_value_num shows the posts in the numerical order with respect to a custom field key that we define.
All these parameters restrict the post order in some way. The best way to order the posts in the slider is to use the meta_value_num parameter. You can order the slides in any order you want if you use this option.
To use it for pages, find this code in includes/featured.php file,
('post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'post__in' => get_option('nova_feat_pages'),
'showposts' => $featured_num)
);
and replace it with this code,
('post_type' => 'page',
'orderby' => 'meta_value_num',
'meta_key' => 'slide_sort_key',
'order' => 'ASC',
'post__in' => get_option('nova_feat_pages'),
'showposts' => $featured_num)
);
To use it for posts, find this code in includes/featured.php file,
and replace it with this code,
Now add a custom field with name slide_sort_key and a numerical value to each page/post in the slider. The slides will be then ordered in the order of the slide_sort_key.
Please take backup of the theme files before you make any changes to them. Also, this tutorial is very generalized and should work for most of the WordPress themes from Elegant Themes.
However, it may not work for some older themes or for the themes that are released by Elegant Themes after I wrote this tutorial. In that case, you can ask the question on the Elegant Themes support forum or hire me to implement the custom order for slides in the featured slider.
Thanks for the tip on this. Makes it much easier to manage the slides in the feature area.
And if you want to mix parent/sub-pages, you can just order them 10, 20, 30, 11, 12, 21, 22 etc…