• This is a very useful theme for a site I am making to manage just audio post-formats. When there are more than one posts of this format, on the home page and all archive views, the nicely formatted jQuery loaded media player only shows for the first post, the remaining have the standard audio player.

    I noticed in content-audio.php the player is loaded with

    <audio controls="controls" id="audio-player">

    Since the jQuery looks for IDs only, it will only affect the first one:

    // Add custom audio player
    	$('#audio-player').mediaelementplayer({
    	    alwaysShowControls: true,
    	    features: ['playpause','progress','volume'],
    	    audioVolume: 'horizontal',
    	    audioWidth: 872,
    	    audioHeight: 100
    	});

    To fid this, my child theme has its own content-audio.php with

    <audio controls="controls" class="audio-player">

    and the extra JS I am enqueing has

    // Add custom audio player
    	$('.audio-player').mediaelementplayer({
    	    alwaysShowControls: true,
    	    features: ['playpause','progress','volume'],
    	    audioVolume: 'horizontal',
    	    audioWidth: 872,
    	    audioHeight: 100
    	});

    And it seems to be working as I expect.

    This was just a quick test but it would affect any site using more than one audio post-format type post.

    This, like your others, are really elegant themes, and I like building sites from them because they are not bloated.

  • The topic ‘Audio Player Needs to be Class Not ID’ is closed to new replies.