Implementing “Video of the Day” Feature?

I’d like to add a new area on a WordPress 3.0 site that contains a new video from YouTube each day. This video would be manually picked, and manually added each day. I’m not sure how to properly set this up though.

My current thought-process is that I would create a category called “videos,” and then add a new post in that category each day placing the embed code as the post-body. This seems like ugly hackery though, so I’m open to a better and more leaner solution. Ideally I would have a simple admin-side form where I would put in a title, and the link to the YouTube video (converting the link to an embed code on my own programmatically).

Read More

Does WordPress 3.0 accomodate odd post types like this pretty well? What should I read to gain a better understanding of how I would accomplish things like “video of the day”, and “daily cartoons”?

Related posts

Leave a Reply

2 comments

  1. Hi @Jonathan Sampson:

    @EAMann is spot-on, Custom Post Types are the way to go.

    Here’s code you can toss in your theme’s functions.php file to implement the Custom Post Type you need (note I included a helper function make_post_type_labels() I like to use that reduces the complexity of defining Custom Post Types):

    register_post_type('daily-video',
      array(
        'labels'          => make_post_type_labels('Daily Video'),
        'public'          => true,
        'show_ui'         => true,
        'query_var'       => 'daily-video',
        'rewrite'         => array('slug' => 'daily-videos'),
        'hierarchical'    => true,
        'supports'        => array('title','editor',
      )
    );
    function make_post_type_labels($singular,$plural=false,$args=array()) {
      if ($plural===false)
        $plural = $singular . 's';
      elseif ($plural===true)
        $plural = $singular;
      $defaults = array(
        'name'               =>_x($plural,'post type general name'),
        'singular_name'      =>_x($singular,'post type singular name'),
        'add_new'            =>_x('Add New',$singular),
        'add_new_item'       =>__("Add New $singular"),
        'edit_item'          =>__("Edit $singular"),
        'new_item'           =>__("New $singular"),
        'view_item'          =>__("View $singular"),
        'search_items'       =>__("Search $plural"),
        'not_found'          =>__("No $plural Found"),
        'not_found_in_trash' =>__("No $plural Found in Trash"),
        'parent_item_colon'  =>'',
      );
      return wp_parse_args($args,$defaults);
    }
    

    Also you might find these two answers to be helpful as well: