A shortcode slider with Flexslider
-
Hello!
I try to make a shotcode slider with flexslider using this tutorial:
So i want to modify the post query to implement a category option in my shortcode.
Someone can help me please?
I try that:
function e_insert_slider($atts, $content=null){ $slider= e_get_slider(); $categoryname = $content; return $slider; } add_shortcode('e_slider', 'e_insert_slider'); function e_get_slider(){ $slider= '<div class="flexslider"> <ul class="slides">'; // assign the variable as current category // run the query query_posts("&categoryname=".$categoryname); 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></br>'; return $slider; } /**add template tag- for use in themes**/ function e_slider(){ print e_get_slider(); }
- The topic ‘A shortcode slider with Flexslider’ is closed to new replies.