Custom FlexSlider script not displaying links properly
-
I’m creating a custom plugin that utilizes the FlexSlider jQuery plugin to display a slideshow of a custom post type. However, I’ve run into a snag. Either something is hard-wired in the js that I’m missing or I’m doing something wrong on my end.
Here is the loop the fills the slideshow….
function efs_get_slider(){ $slider= '<div class="flexslider"> <ul class="slides">'; $efs_query= "post_type=events"; query_posts($efs_query); if (have_posts()) : while (have_posts()) : the_post(); $img= get_the_post_thumbnail( $post->ID, 'large' ); $link= esc_url (get_post_meta( $post->ID, '_link', true )); $slider.=' <li><a href="' .$link. '">' .$img. '</a></li> '; endwhile; endif; wp_reset_query(); $slider.= ' </div>'; return $slider; }
The issue comes with the $link variable. I have a custom meta field for my custom post type that just holds an external link. I’m thinking it has something to do with my loop and not the js file because when I manually put a link into the code, the links show up fine in the slideshow.
However, I ran the same query on a test page without using the slideshow and it seems to work fine.
I’ve done this with and without the esc_url function and have the same results. I can provide the js file so you can see the code, too.
A working test page of the slider can be found at the address below. Below the slideshow is the output of the same query_posts loop but not using the slideshow.
https://www.curemyway.com/test-page
I’m at a loss here. Any help is greatly appreciated.
- The topic ‘Custom FlexSlider script not displaying links properly’ is closed to new replies.