Support » Fixing WordPress » Using custom meta boxes on custom post types

  • I am attempting to create a site with a good theme for TV shows and what not, I have managed to come up with everything, even the custom post types and their functionality, removing most of the capabilities.

    I am trying to create multiple meta boxes for information such as Episode title, Season number, original air date, and option for a few photos to be uploaded, a small synopsis pretty basic. I can see the HTML coding to be easy for the structure of the meta boxes.

    However, I cannot found out how to add meta boxes that will allow all of this to work. Any help is appreciated.

    — Andrew

Viewing 4 replies - 1 through 4 (of 4 total)
  • I wrote this code for a page template page of posts, it should have most of what you want.

    There is a download of a child theme with the code on this post, it might be easier to look at!



    Thanks David,

    That is exactly what I am looking for the only problem, is I created a custom post type for the Episodes and I’d like to not give post formats an option but just set this as the default.

    Any ideas how to come about this?


    I am not sure what you mean by not give post formats and set this as a default?

    Do you mean the single page layout?

    You can just use a custom single.php to display your episodes and save single.php as episode.php, then you can use a custom loop to control the output.

    In functions.php (Child Theme) add:

    /* A single.php just for custom post type == 'episode' */
    function my_episode_template_redirect() {
    	global $wp;
    	if ($wp->query_vars['post_type'] == 'episode') {
    		if( file_exists( get_stylesheet_directory() . '/episode.php') ) {
    			include( get_stylesheet_directory() . '/episode.php');
    add_action("template_redirect", 'my_episode_template_redirect');

    Note: in a child theme we use get_stylesheet_directory() in a parent theme we change this and use get_template_directory()



    OK, this is getting more complicated than I anticipated.

    I was hoping to just be able to go to Add New under the Episodes custom post type in the WordPress Admin Dashboard.

    And the screen would open up with an Episode title text input, then an upload-able box (browse) for the episode photo cover. Then maybe a textarea for an episode synopsis. Then possibly a few upload-able (browse) boxes for a photo gallery. And then maybe a textarea for a link to a YouTube trailer for the episode.

    And then also maybe text inputs that would allow inks to buy the episode of iTunes, or Amazon, or watch on HBO GO.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using custom meta boxes on custom post types’ is closed to new replies.