wp_query not working for some reason
-
Hello! I really love this plugin. Easy to use, easy to amend, although I faced an issue and can’t find a way to fix it…
inside yarpp template I have this code:
$mainaudio = new WP_Query(array('posts_per_page' => '1','post_parent' => $post->ID,'post_status' => 'inherit','post_type' => 'attachment', 'post_mime_type' => 'audio', 'orderby' => 'menu_order', 'order' => 'ASC', 'meta_query' => array(array('key' => 'voice-reel','value' => 'Main Reel','compare' => 'LIKE',)))); if ( $mainaudio->have_posts() ) : echo "<span>Voice Sample</span>"; while ($mainaudio->have_posts()) : $mainaudio->the_post(); $audiourl = addslashes(wp_get_attachment_url( $post->ID )); echo do_shortcode( '[audio src="' . $audiourl . '"]' ); endwhile; else: echo "no posts"; endif; wp_reset_postdata();
It is supposed to pull audio attachment and display it as audio shortcode. Code is fine, since it displays and works on other pages, but as soon as I place it in yarpp template, it doesn’t give me the results. I feel like it doesn’t like ‘new WP_Query’ callout… is there a way to fix it?
Thank you a lot!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘wp_query not working for some reason’ is closed to new replies.