Custom post not showing

I created custom post type in my functions.php with the following code:

function awesome_custom_post_type(){         $labels = array(         'name' => 'Portfolio',         'singular_name' => 'Portfolio',         'add_new' => 'Add Item',         'all_items' => 'All Items',         'add_new_item' => 'Add Item',         'edit_item' => 'Edit Item',         'new_item' => 'New Item',         'view_item' => 'View Item',         'seach_item' => 'Search Portfolio',         'not_found' => 'No items found',         'not_found_in_trash' => 'No items found in trash',         'parent_item_colon' => 'Parent Item'             );     $args = array(         'labels' =>  $labels,         'public' => true,         'has_archive' => true,         'publicity_queryable' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'supports' => array(                 'title',                 'editor',                 'excerpt',                 'thumbnail',                 'revisions',          ),         'taxonomies' => array('category', 'post_tag'),         'menu_position' => 5,         'exclude_from_search' => false     );     register_post_type('portfolio',$args); } add_action('init','awesome_custom_post_type'); 

The Portfolio is added on my dashboard and I can create a post. the Problem I see is that,when am in post and click on the permalink it gives me a 404 error so I can view the post.

How can I view the Post?

I tried adding another file called single-portfolio but still it didn't work:

get_header(); ?>     <div id="primary" class="content-area">         <main id="main" class="site-main" role="main">         <?php         while ( have_posts() ) : the_post();             get_template_part( 'template-parts/content', get_post_format() );             the_post_navigation();             // If comments are open or we have at least one comment, load up the comment template.             if ( comments_open() || get_comments_number() ) :                 comments_template();             endif;         endwhile; // End of the loop.         ?>         </main><!-- #main -->     </div><!-- #primary --> <?php get_sidebar(); get_footer(); 

Replay

Category: custom post types Time: 2016-07-29 Views: 0

Related post

  • Why are some of my custom posts not showing up on my page? 2013-09-22

    I have 6 posts with a custom post type in my Wordpress theme. I want to show them all on a page but I can only get a maximum of 3 to show up, regardless of how many there are. I have this code in the page: <?php $count_posts = wp_count_posts( 'cases'

  • Thumbnails for custom post not showing up in query 2013-12-09

    My thumbnails are not showing up in my custom post type when I do a query, however they show in the single.php file. I have added 'supports' => array('title','editor','author','thumbnail','excerpt','comments') to the function so I know its not that i

  • Meta data (Tags and Categories) for Custom Posts not showing. 2014-12-24

    I registered a custom post type ("movie") with tags and categories. Now, I'm able to filter and search for the custom post with these tags and categories, so I know they're present and working, but they're not showing up on the custom posts. Thi

  • Posts not showing with custom categorybase and subcategories 2012-06-16

    Edit: Fixed. I had an error in my permlink structure. I have a problem with individual posts not showing with their URL. I have set a custom category base in Permlinks called 'story'. I have a blogpost category called 'chapters', which has a subcateg

  • posts not showing on index.php 2012-09-10

    Live site. I've got a custom theme, wherein the homepage(front-page.php) is static and the "posts" page is Press(index.php). Everything with the theme works great, with the exception of the posts not showing when viewing the Press page- it shows

  • older blog posts not showing in new theme 2013-03-05

    I have a new, custom theme that I've uploaded on a pre-existing site/blog. Everything seems to be working ok, with the exception of the older blog posts not showing up. Any ideas what I can do to fix? <?php get_header();?> <div id="blog-cont

  • Why do my custom post types show up in the dashboard, but not on my site? 2011-10-21

    I added the following code to my functions.php file to create a custom post type. function create_post_type() { register_post_type( 'mysite_reviews', array( 'labels' => array( 'name' => __( 'Reviews' ), 'singular_name' => __( 'Review' ) ), 'publi

  • Custom Post type showing up in loop, regular posts are not showing up 2013-02-23

    Every one knows the basic WordPress loop, every one knows that if you want just posts in a loop you put query_posts("post_type=post"); BEFORE the loop. which I have done. The problem is I have a custom post type, called mini feeds, which shows u

  • Users with custom roles not showing in post author select box 2013-03-21

    I am using a function to create new user roles and delete some defaults. However, they are not showing up in the post author box! Only the admin shows up because they are selected as an admin. Any user with a custom role does not show up. Any idea wh

  • Custom Post Type Posts Not Showing Up in Admin 2014-01-20

    I am using this theme called IronBand. It has a few custom post types, and one of them is called "Gig." I created some custom posts under that Custom Post Type. Later, I wanted to changed the name of the Custom Post Type to "Show," so

  • Strange issue with custom fields not showing data for certain posts but working fine on others 2016-02-06

    I have a very strange issue with custom fields on my site. I am using the custom fields for custom post types. So lets say the custom post type is called "cars". I will have various custom fields like "make", "model", "c

  • Custom Fields not showing up for custom post type 2016-07-30

    I'm a little new to WordPress development and am SO frustrated-- I created some custom post types, and am trying to add custom fields to them. For some reason, the fields will just not show up when I try to add a new post!!! Here is my code--this is

  • Custom Post Type Taxonomies -Posts not showing in Category or Tag pages 2013-01-23

    I have a made a custom post type called "Member Resources" the posts under this CPT have a few taxonomies such as categories and tags. Tags = "Diversity" Categories = "Guidance" When I go to the following urls: www.domain.com

  • categories of custom post type shows in CMS but not in the frontend webpage 2013-03-11

    I have created a custom post type "Events" and added the categories function for it. However, the categories only shows in the backend CMS which I can set and add new categories, but no message indicating the category that a event was set for in

  • Post not showing in my custom advanced search 2015-12-01

    I've created a custom-search-page for my theme that have to search in my CPT non-hierarchical taxonomy and eventually filter the results if some preference is inserted through the options form of custom-fields. i have and advanced-searchform.php that

  • Custom Post Type - shows pagination (w/404) or posts_per_page query, not both 2015-12-16

    I have a custom post type of 'gallery', and I'm using a template for the archive of 'page-student-gallery.php'. My admin settings for posts shown is 5, I'd like it to show 9 on this page, of just gallery items. I've been able to manage the query wher

  • Template for custom post type shows all posts instead of just one 2013-07-30

    I wrote a simple plugin to create a custom post type named "people": add_action( 'init', 'create_person' ); function create_person() { register_post_type( 'people', array( 'labels' => array( 'name' => 'People', 'singular_name' => 'Perso

  • Custom fields not showing on front-end after xml import 2013-11-06

    I've just imported 700+ custom posts from one WP install to another using the XML import/export option. Everything seems to be imported fine: the field values are showing in the DB and on the admin side. However, if I try to get the field value on th

  • Custom Taxonomy Not Showing in Menu 2013-11-15

    Using Wordpress 3.7.1 and PHP 5.4.12 I am trying to create a Custom Post Type called "News" and an associated Taxonomy Called "Subject". I generate the code from Generate WP site as below: After running the code I figure out that the T

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 1.036 (s). 13 q(s)