2268 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Won a competition
+16 more
mpc
says
Hi, I am using a custom post type and custom taxonomy for my portfolio, below you can see how I register it:
function create_portfolio() {

    register_taxonomy('portfolio_cat','portfolio', array(
            'hierarchical' => true,
             'show_ui' => true,
            'query_var' => true,
    )); // add unique categories to portfolio section 

    $portfolio_args = array(
            'label' => __('Portfolio', 'agera'),
            'singular_label' => __('Portfolio', 'agera'),
            'public' => true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'rewrite' => true,
            'supports' => array('title', 'editor', 'thumbnail'),
            'taxonomies' => array('post_tag')
    );

    register_post_type('portfolio', $portfolio_args);
}

add_action('init', 'create_portfolio');

Inside my single.php (which displays the single portfolio page) I have a line which displays the categories of Portfolio post types.

<?php echo get_the_term_list( get_the_ID(), 'portfolio_cat', "", ", ");  ?>

In such setup what file should be called if I get the 404 page. I have category.php and taxonomy.php setup.

438 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
Pixelous
says
Maybe this will help you: Note: In some cases the permalink structure must be updated in order for the new template files to be accessed when viewing a custom post type. To do this go to the permalink menu, change the option to a different option, save the changes, and change it back to the desired option. In the form of the single-type-template. In the same way that posts are shown on their own page with single.php, custom post types will use single-{posttype}.php if it’s available. http://codex.wordpress.org/Post_Types
2268 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Won a competition
+16 more
mpc
says

My single portfolio items are displayed on the single.php page I don’t have a problem with this I have a problem with displaying posts which are contained inside custom category. For example when I click on one of the portfolio cateogies I get 404 page, the url structure looks like this localhost:8888/agera/portfolio_cat/custom_category/

737 posts
  • Has referred 1000+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Became a Top 20 Author of the Month
+9 more
mordauk
says

It’s probably a problem with your taxonomy.php template. Can you post its contents?

A small note: please prefix your function for creating the post type.

501 posts
  • Has referred 1000+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Became a Top 20 Author of the Month
+10 more
pixelentity
says

if you get the 404 page, problem is permalink structure not being updated (as pixelous pointed out). Either save the permalink page or call once flush_rewrite_rules() .

BF

2268 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Won a competition
+16 more
mpc
says

call once flush_rewrite_rules() . BF

That solved my problem, thanks!

737 posts
  • Has referred 1000+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Became a Top 20 Author of the Month
+9 more
mordauk
says


call once flush_rewrite_rules() . BF
That solved my problem, thanks!

Make sure that you have NOT added that to your create_portfolio() function. flush_rewrite_rules() should only ever be run one time at theme/plugin activation.

2268 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Won a competition
+16 more
mpc
says



call once flush_rewrite_rules() . BF
That solved my problem, thanks!
Make sure that you have NOT added that to your create_portfolio() function. flush_rewrite_rules() should only ever be run one time at theme/plugin activation.

Should it be added to the release version?

116 posts YeahThemes
  • Had an item that was trending
  • Elite Author: Sold more than $75,000 on Envato Market
  • Had an item that became a weekly top seller
  • Sells items exclusively on Envato Market
+4 more
Yhthms
says

if you get the 404 page, problem is permalink structure not being updated (as pixelous pointed out). Either save the permalink page or call once flush_rewrite_rules() . BF

+1 just re-save the Permalinks.

737 posts
  • Has referred 1000+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Became a Top 20 Author of the Month
+9 more
mordauk
says




call once flush_rewrite_rules() . BF
That solved my problem, thanks!
Make sure that you have NOT added that to your create_portfolio() function. flush_rewrite_rules() should only ever be run one time at theme/plugin activation.
Should it be added to the release version?

What do you mean the release version? The version you release here on Code Canyon or Theme Forest? Sure, as long as you have only included it in an activation hook.

by
by
by
by
by
by