custom post type - Flexslider Wordpress - Adding Captions and External Links to Featured Images -
so have been attempting integrate captions , links envato flexslider plugin found on @ nettuts.
http://wp.tutsplus.com/tutorials/create-a-responsive-slider-plugin-with-flexslider/
adding caption area 'flexslider plug-in' not work.
here envato-flexslider.php file magic happens.
<?php /* plugin name: envato flexslider plugin uri: description: simple plugin integrates flexslider (http://flex.madebymufffin.com/) wordpress using custom post types! author: joe casabona version: 0.5 author uri: http://www.casabona.org */ /*some set-up*/ define('efs_path', wp_plugin_url . '/' . plugin_basename( dirname(__file__) ) . '/' ); define('efs_name', "envato flexslider"); define ("efs_version", "0.5"); /*files include*/ require_once('slider-img-type.php'); /*add javascript/css files!*/ wp_enqueue_script('flexslider', efs_path.'jquery.flexslider-min.js', array('jquery')); wp_enqueue_style('flexslider_css', efs_path.'flexslider.css'); /*add hooks place javascript in header*/ function efs_script(){ print '<script type="text/javascript" charset="utf-8"> jquery(window).load(function() { jquery(\'.flexslider\').flexslider({ animation: "slide", slideshowspeed: 6000, animationduration: 300, directionnav: false, controlnav: false }); }); </script>'; } add_action('wp_head', 'efs_script'); function efs_get_slider(){ $slider= '<div class="flexslider"> <ul class="slides">'; $efs_query= "post_type=slider-image"; query_posts($efs_query); if (have_posts()) : while (have_posts()) : the_post(); $img= get_the_post_thumbnail( $post->id, 'large' ); $slider.='<li>'.$img.'</li>'; endwhile; endif; wp_reset_query(); $slider.= '</ul> </div>'; return $slider; } /**add shortcode slider- use in editor**/ function efs_insert_slider($atts, $content=null){ $slider= efs_get_slider(); return $slider; } add_shortcode('ef_slider', 'efs_insert_slider'); /**add template tag- use in themes**/ function efs_slider(){ print efs_get_slider(); } ?>
as adding external links featured images, have tried setup custom fields in custom post types through slider-img-type.php file , has not worked.
thanks help, dustin
ok, how able integrate both links , captions flexslider. hope helps has been struggling mightily have. in envato-flexslider.php here need function efs_get_slider(). make sure name custom fields in slides image_caption , image_link respectively.
function efs_get_slider(){ $slider= '<div class="flexslider"> <ul class="slides">'; $efs_query= "post_type=slider-image"; $myposts = get_posts($efs_query); foreach($myposts $post) : setup_postdata($post); $img= get_the_post_thumbnail( $post->id, 'full' ); $slide_link= get_post_meta( $post->id, 'image_link', true); $slide_caption= get_post_meta( $post->id, 'image_caption', true); $slider.='<li><a href='.$slide_link.'>'.$img.'</a><p class="flex-caption">'.$slide_caption.'</p></li>'; endforeach; $slider.= '</ul> </div>'; return $slider; }
Comments
Post a Comment