Last active
August 29, 2015 14:13
-
-
Save Chrisedmo/bf07d753b1eb16ab975d to your computer and use it in GitHub Desktop.
Wordpress: Simple optionTree + Slick gallery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this in as $page_options_meta = array unde 'fields' | |
array( | |
'label' => 'Insert Slider', | |
'desc' => 'Select images to display in the header. Images must be 1200px wide by 410px deep.', | |
'id' => $prefix . 'banner_slider', | |
'type' => 'gallery' | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="image-banner"> | |
<?php $banner_slider = get_post_meta( $post->ID, 'tpa_banner_slider', true ); ?> | |
<?php if (!empty($banner_slider)): ?> | |
<?php $banner_slider = explode(",",$banner_slider); | |
foreach ($banner_slider as $imageID) :?> | |
<?php $image_src = wp_get_attachment_image_src($imageID, 'full'); ?> | |
<div> | |
<img src="<?php echo $image_src[0];?>"/> | |
</div> | |
<?php endforeach; ?> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could tidy this up a bit. Maybe have a fallback if no slider is selected to featured image.