This may prove useful to others, which is what I did for a client’s website. The coding that controls the slider is located in wp-content\themes\advantage\pages\featured.php. It creates a typical WP_Query object for retrieving the content needed for the slider – which we can edit in many ways as needed.
I created a meta-box for my pages, which involve two pieces of metadata:
- Tickbox for if the page is to go in the slider
- Weburl for if the link is to go somewhere other than the page
- ‘homepageordernumber’, which is used to do the order the page will appear in the slider
I tweaked the WP_Query object in featured.php to call pages (rather than posts), to order by my homepageordernumber metadata field and to check if the tickbox metadata was ‘true’. Then I replaced the permalink command with a variable that called my Weburl metadata.
Finally, I created an admin page which called the homepage slides and allowed for easy re-ordering.
The coding I added to the the functions.php to achieve this is here:
Note that this coding places the option to edit the homepage slider under settings in the admin window.
The WP_Query I use in featured.php is this:
$featured_args = array(
'post_type' => 'page',
'post_status' => 'publish',
'posts_per_page' => $post_pp,
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'orderby' => 'meta_value_num',
'meta_key' => 'homepageordernumber',
'order' => 'ASC',
'meta_query' => array ( array(
'key' => 'homepagecheckbox',
'value' => 'Yes' ))