Show audio player only in specific post type
This is untested, but it seems to me that you could simply replace the: $audio = “<audio src=”https://wordpress.stackexchange.com/questions/382777/$url” controls autoplay loop></audio>”; with $autoplay = is_singular( ‘your_post_type’ ) ? ‘autoplay’ : ”; $audio = “<audio src=”https://wordpress.stackexchange.com/questions/382777/$url” controls $autoplay loop></audio>”; I.e. We use the $autoplay variable to store the autoplay attribute, and if the current page is … Read more