Try to pass the Id of the post type.
Change
$file = get_attached_media('audio'); To
$file = get_attached_media('audio',get_the_ID());
Related Posts:
- how to override woocommerce specific loop or archive-product.php [closed]
- How can I create an alternative home page?
- Multiple Queries and Excluding Repeating Posts?
- Last post is not showing up
- get_option issues
- Show post page only if the user has bought a specific product
- Adding Pagination on a Custom Author Page
- Exclude custom taxonomy tag from loop
- Loop through custom fields with similar label / common chars in label
- Pagination Issues using WP_Paginate Plugin
- CPT Loop with ACF and passing ID between Loops
- How can I display a PHP foreach loop’s answers by AJAX
- toggle Multiple Loop with tittle
- Exclude current post but keep the same posts-per_page amount
- wordpress custom fields loop
- How to show related post with category DESC (ASC) IDs of ID current post
- Avoid showing the same phrase in the loops
- Multiple loops on same category with different design
- Custom query pagination with php parameter as arg problem
- Multisite – Getting Meta query to select from wp_2 tables
- How to append the excerpt to the content in the single post page?
- Multiple Owl Carousels on the same page with navigation problem
- Pull A Single Post Prior To Running wp_query
- Highlight specific user with custom field value
- Secondary loop doesn’t work
- Post thats in Two Categories, only want to display name for one
- Loop display only 5 posts
- How do I make my child theme re-apply the settings that were customised when its parent was active?
- How to add a new product type on woocommerce product types? [closed]
- How to add Disqus comment count
- Can WP Customizer work with single pages or posts?
- Enabling Sessions in WordPress 3.0
- WP Super Cache separate cache for mobile
- Search through custom post type and custom fields takes 5 minutes
- ensure user can only be logged in on one computer at a time?
- WordPress prompt checklist before publish?
- Preventing Search Engines Indexing Pages 2, 3 and More?
- where can i add custom script to stop header video from autoplay
- How to store foreign language characters in WordPress? [closed]
- What’s the easiest way to periodically (automatically) read static Markdown content into a WP page?
- How to use get_option() without any filter?
- Is it possible to replace PHP with NodeJS?
- Change separators in HTML tags
- Problem with using wp-load.php outside of WordPress
- Cannot figure out how to center div in WordPress theme [closed]
- How to implement a custom password field that redirects to another page upon correct password?
- Automatically check parents (in a taxonomy) when child is selected
- Adding custom field in all widgets, but at the top of the form, in admin area
- Always logged in even if remember me is unchecked?
- Adding posts to custom menu [closed]
- How to add an extra variable to login and authenticate it?
- Theme Customization through admin panel. (Appearance-Customize)
- Diffrent User registration form for doctor and patient
- 404 (category, pages, archives) when using custom rewrite rules
- Keep Title and Description always
- Changer numbers of columns in woocommerce shop
- Use custom header as WordPress header
- WordPress : using AJAX to get posts & Sidebar Content to an external application
- str_replace inside specific css files [closed]
- How do I modify the size of the text in my page titles?
- How to edit alternate inactive themes in “Appearance -> Customise” screen?
- Prevent Multisite from creating sample page, sample post and sample comments
- wordpress shortcode not working
- WordPress Code Snippet to count total posts by author
- Custom Same Page Search
- Inline-Table under TwentyTwelve not working
- Allow a subscriber to be an author and view only his post
- How to activate flash cards
- Transferring theme and imported post attachments
- Personalized Gallery what are my options?
- Trying to use .htaccess to redirect /profile to /login-2?action=profile
- How to make WordPress search page use a relative path
- What is my error trying to create a new table in the database?
- Gender based user avatar
- Need to add custom text field to Woocommerce under add to cart button
- How to add a template – so that i can choose a different menu for some pages
- Allow WP users to sort search result on a videos site
- wp.blocks.registerBlockType not showing what I want on the frontend
- Add a menu item to admin dashboard which isn’t a link? [duplicate]
- How to narrow the area between buttons on Helium theme sidebar? [closed]
- How to add the option to choose between sizes for featured image within post editor?
- Customize WP website specific column with CSS
- Structure of post types for TV Shows and episodes
- Adding images to anchors in the list created and fetched with wp_nav_menu
- In wordpress customizer api adding div wrap to control
- Background setting isn’t applied to entire sidebar height
- How come there is no wp-content directory in wp theme
- Image Upload Failing from WP_Editor
- Custom field front end update in wordpress
- What shortcode should I use for
- Database custom table issues – incorrect result displayed
- Special characters showing in fallback font
- Trying to achieve row posts below category with multiple loops in custom tax
- How to strip thumb from widget
- Customize Admin Section
- Want home page to click through to two different page types
- add unique code required to register
- Not Found when using activity stream as front page with BuddyPress
- How to add custom page using them in wordpress 3.5
- woocommerce display product category on checkout page [closed]