Hi there, hoping someone here can help me out.
I am working on a custom home page template where we’d like to embed the most recent podcast’s audio player below the excerpt of the post, so they can listen directly from the website’s homepage without having to click through.
I am using the following code to accomplish this so far, but have been unable to figure out how to call the audio player itself, in spite of copying and pasting the code from the single-podcast.php template file.
<?php $query = new WP_Query( array( 'post_type'=>'podcast', 'taxonomy'=>'featured', 'posts_per_page' => 1 ) ); while ($query->have_posts()) : $query->the_post();?> <article> <header class="article-header"> <h1 class="h2"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></h1> <p class="byline vcard"> <?php printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(get_option('date_format')), bones_get_the_author_posts_link(), get_the_category_list(', ')); ?> </p> </header> <!-- end article header --> <section class="entry-content clearfix"> <?php the_excerpt(); ?> <a href="<?php echo get_post_meta(get_the_ID(), 'enclosure', true) ?>">Download Audio</a> Duration: <?php echo get_post_meta(get_the_ID(), 'duration', true) ?> | Size: <?php echo get_post_meta(get_the_ID(), 'filesize', true) ?> </section> <!-- end article section --> </article>
Obviously I figure out how to call the custom meta data, but I can’t seem to get any of that to become the embedded player. Is there some class or ID that the script looks for specifically? I am working on examining the plugin code in more depth, but my functional PHP is still a work in progress.
Thanks in advance!
- The topic ‘Calling audio player to another page template?’ is closed to new replies.