I'm trying to list all of my posts in a page(with post's content). Everything is showing correctly but the audio player which uses post id to get the URL of an attachment in the post is not showing. I'm using the following code to get the post ID:-
global $wp_query; $postID = $wp_query->$post->ID; $file_id = get_post_meta( $post->ID, sound_s, true ); $fileUrl = wp_get_attachment_url($file_id); $attr = array( 'src' => $fileUrl, 'loop' => '', 'autoplay' => '', 'preload' => 'none' ); echo wp_audio_shortcode( $attr );
It works in the post itself but when I try to list it in the page the post ID shows page Id instead. Please help me with this.