WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a post with audio player with autostart enabled, and i decided to put it in the beginning of the post, before putting "read more" excerpt feature. So the problem is, that audio player plays music on the main page, but i want it to work only on post page. Is it possible to do? I've put my post in drafts for now, until i solve this little problem...

share|improve this question
By post page do you mean "single post" page? – MartinJJ Jun 20 '11 at 13:49
up vote 0 down vote accepted

The simplest solution would be to put the audio player after the read-more link.

If that would prove cumbersome (e.g. you've already got too may posts with audio players), you could try hooking into the the_content filter, and remove the audio player if not on a single-post view. e.g.:

function mytheme_remove_audio_player_from_home( $content ) {
    // is_singular() is true for 
    // single posts, pages, and attachments
    if ( ! is_singular() ) {
        // do something, such as a str_replace() or 
        // whatever else would be appropriate, to
        // filter out the audio player markup
    return $content;
add_filter( 'the_content', 'mytheme_remove_audio_player_from_home' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.