• Resolved akilham

    (@akilham)


    I was wondering what the easiest way to add details of the latest podcast to the header of the website would be? Ideally it would display something like the episode number and the title of the episode, either linking to the permalink page for the podcast or just directly to the mp3 file.

    I’m very familiar with PHP and can code anything up, but I’m just not sure what the best way to go about this is. I could write a plugin that grabs the latest podcast from the database and displays the info that way, I’m just not sure if this is the best option? Basically I just need to know the best way to actually access the latest podcast title, episode, and a permalink to it, and then I can display that info however I want in the header.

    http://wordpress.org/extend/plugins/seriously-simple-podcasting/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Hugh Lashbrooke

    (@hlashbrooke)

    You can do this kind of thing using basic WordPress functions. The easiest way would probably be to use a custom WP Query (reference) and query with a post type of ‘podcast’. You can then use get_post_custom() to get all the meta data for the episode – this will contain the audio file URL, track length, etc. You can also use get_the_terms() using the ‘series’ taxonomy to get the series that the episode is assigned to. If you know PHP that shouldn’t be difficult to get right and it will give you the data that you need.

    In the future I might build a shortcode into the plugin that allows you to pull this kind of data easily, but for now the basic WP functions will handle things for you just fine.

    Thread Starter akilham

    (@akilham)

    Perfect, thanks. Just in case anyone else wants to do this, I used this code to get the latest podcast:

    $the_query = new WP_Query('post_type=podcast&posts_per_page=1');
    
    $the_query->the_post();

    And then to get the meta data, I just used get_post_meta($post->ID, ‘duration’, true);

    Plugin Contributor Hugh Lashbrooke

    (@hlashbrooke)

    Awesome – glad you got things working 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add latest podcast details to website header’ is closed to new replies.