Using advanced custom fields to call in our slider into your theme

If you would like to add our slider to your theme, you could use the Advanced Custom Fields plugin to do this. First what you would need to do, is to create a custom text type field.

Then at your post use that field to identify our slider, for example you could put the shortcode of the slider there.

After this Advanced Custom Fields offers a get_field function to read out the data from your field, and WordPress has a do_shortcode function, which can be used to run shortcodes in your theme's files. You can use these functions in your theme:

<?php
  $slider = get_field('slider');
  if($slider){
      echo do_shortcode($slider);
  }
?>

The if($slider) is correct, because if you didn't give anything to that field, it will return "false".

And you could even extend this, because in most themes there is a common posts page, and this custom field is called in from there too, so in case you would only want the slider on the page, where the actual post is, then you should also use the is_single function:

<?php
  $slider = get_field('slider');
  if($slider && is_single()){
      echo do_shortcode($slider);
  }
?>