• Hi Guys,

    I just started building my own WordPress theme today and it’s going pretty good. I’m just a bit stuck now.

    I have built a custom post type called “Portfolio” and in it I have 3 categories.
    I also have three custom pages that I want only the relevant category to feed into.

    How do I do this?

    This is my functions file:

    <?php
    
    //ADD MENU
    add_theme_support('menus');
    
    //ADD CUSTOM POST
    add_action( 'init', 'create_portfolio' );
    
    function create_portfolio() {
      $labels = array(
        'name'              	 => _x( 'Portfolio', 'post type general name' ),
        'singular_name'     	 => _x( 'Portfolio', 'post type singular name' ),
        'add_new'           	 => _x( 'Add New', 'book' ),
        'add_new_item'      	 => __( 'Add New Portfolio' ),
        'edit_item'         	 => __( 'Edit Portfolio' ),
        'new_item'          	 => __( 'New Portfolio' ),
        'all_items'         	 => __( 'Portfolio' ),
        'view_item'         	 => __( 'View Portfolio' ),
        'search_items'      	 => __( 'Search Artwork' ),
        'not_found'         	 => __( 'No Artwork found' ),
        'not_found_in_trash'	 => __( 'No Artwork found in the Trash' ),
        'parent_item_colon' 	 => '',
        'menu_name'				=> 'Portfolio'
      );
    
      $args = array(
        'labels'        		=> $labels,
        'description'   		=> 'Holds Portfolio work and portfolio specific data',
        'taxonomies' 			=> array('category'),
        'public'        		=> true,
        'menu_position' 		=> 5,
        'menu_icon'				=> 'dashicons-format-image',
        'supports'      		=> array( 'title', 'editor', 'thumbnail' ),
        'has_archive'   		=> true,
      );
      register_post_type( 'Portfolio', $args );
    }
    
    //ADD FEATURED IMAGE
    add_theme_support( 'post-thumbnails' );
    
    ?>

    and here is one of the custom pages so far:

    <?php
    /*
    Template Name: Portfolio Page
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="portfolioPageHeader">
    	<h1> <?php wp_title(""); ?></h1>
    </div>
    
    <?php get_footer(); ?>

    Basically what I am trying to do is only have the featured image show up on the page and when you click it it then takes you to that post for more info.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom post category feed’ is closed to new replies.