WordPress CMS has a lot of useful features e.g. shortcodes, custom fields.
Look at the code example below:
function my_slider( $atts ) { global $post; extract( shortcode_atts( array( 'slide_category' => 0 ), $atts, 'slide_category' ) ); /* ... */ $args = array( 'post_type' => 'slide', 'showposts' => -1, 'meta_query' => array( array( 'key' => 'slide_category', 'value' => $slide_category, ) ) ); $qry = new WP_Query($args); /* ... */ } /* ... */ add_shortcode('mySlider', 'my_slider');
In example above it allows to output slides of exact category on page.
Possible slider shortcode usage can be:
[mySlider slide_category="1"]
Where mySlider is shortcode, slide_category is shortocode attribute which allows us to display flides of particular category.
To set slide_category – custom field should be added to each slide with slide category id.