Insert slider (Custom Post Type) into pages

Slider:
You will need to create a custom taxonomy (ex: slider) that you will use as an instance of a slider and use the custom post type (ex: slide) as a slide of each slider. There are multiple ways of tackling this but this is the easiest way I can think of.

Shortcode:
For the shortcode you will have to create a shortcode through which you can parse the variables that will make your slider customizable and adaptable to each post. To achieve this you should follow the Shortcode API from WordPress codex

Quicktags:
You can add quicktags into the mix if you want to make a UI for the user to help them set the correct parameters they need. This will programatically add the shortcode into the post.

With this combination you can tell the shortcode to extract X posts (or slides in this case) from a specific term of your custom taxonomy and then use something like bxSlider for the slider itself. This way you can specify which slider you want to display where and parse the parameters you need.

The only way to achieve this properly if you follow this technique is by using term meta for the slider itself and post meta for each slide. Seems like advanced custom fields support both of these.

Leave a Comment