Support » Themes and Templates » Displaying Custom Post Types

  • Further to this post

    I think I’m missing something simple here but being new to WP, I seem to be getting lost easily…

    I have installed a plugin for creating custom post types, and on the admin end its working wonderfully. However, the issues appear at the front end.

    Say I have a new Post Type called ‘Movies’ with a post that I have put in the parent category ‘Film’ and subcat ‘Drama’. It is all displaying correctly in admin.

    Issue 1: The movies are displaying at /wp/movies but are not found via category view at /wp/category/film.
    Issue 2: The post format is being displayed as default via content.php while content-movies.php is being completely ignored.

    I’m using a child theme of Twenty Twelve.

    Is it just that I need to add something to the theme/(child) functions.php? If so please be specific as to what and where.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Issue 1 fixed!

    Placed the following in functions.php (works with menus) – from here:

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($query) {
      if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
        $post_type = get_query_var('post_type');
    	    $post_type = $post_type;
    	    $post_type = array('post','fanvideo','nav_menu_item');
    	return $query;

    Still puzzled over the display issue though…

    Basically is there any way to say (in category view/category.php):

    If post type = ‘custom’ then display template_path (‘content’, ‘custom’) else display default

    where template_path (‘content’, ‘custom’) would be content-custom.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying Custom Post Types’ is closed to new replies.