Conflict with shortcode
-
Simple lightbox breaks when used on the same page with the following shortcode:
Do you know why? The shortcode itself works fine, and so does everything else on the page. I see no errors in the console. But Simple Lightbox is not adding the data attributes to the gallery links when this shortcode is present on the page.
function staffshortcode( $atts ) { extract(shortcode_atts(array('num' => '-1','category' =>''), $atts)); $staffquery = new WP_Query( array( 'post_status' => 'publish', 'post_type' => 'staff', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'department', 'field' => 'slug', 'terms' => $category ), ), )); // the loop if ( $staffquery->have_posts() ) : while ( $staffquery->have_posts() ) : $staffquery->the_post(); $temp_title = get_the_title($post->ID); $temp_excerpt = get_the_excerpt($post->ID); $temp_thumb = get_the_post_thumbnail($post->ID,'resident'); $output .= '<div class="row"><div class="col-sm-4">'.$temp_thumb.'</div> <div class="col-sm-8"><h3>'.$temptitle.'</h3>'.$temp_excerpt.'</div></div><hr />'; endwhile; wp_reset_query(); endif; return $output; } add_shortcode("staff", "staffshortcode");
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Conflict with shortcode’ is closed to new replies.