- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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.
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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/
- Attended a Community Meetup
- Author was Featured
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 3-4 years
- Item was Featured
- Most Wanted Bounty Winner
- Referred between 500 and 999 users
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.
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
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
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
pixelentity said
call once flush_rewrite_rules() . BF
That solved my problem, thanks!
- Attended a Community Meetup
- Author was Featured
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 3-4 years
- Item was Featured
- Most Wanted Bounty Winner
- Referred between 500 and 999 users
mpc said
pixelentity saidThat solved my problem, thanks!
call once flush_rewrite_rules() . BF
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.
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
mordauk said
mpc saidMake 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.
pixelentity saidThat solved my problem, thanks!
call once flush_rewrite_rules() . BF
Should it be added to the release version?
- Exclusive Author
- Sold between 50 000 and 100 000 dollars
- Has been a member for 2-3 years
- Bought between 1 and 9 items
- Referred between 50 and 99 users
pixelentity said
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.
- Attended a Community Meetup
- Author was Featured
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 3-4 years
- Item was Featured
- Most Wanted Bounty Winner
- Referred between 500 and 999 users
mpc said
mordauk saidShould it be added to the release version?
mpc saidMake 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.
pixelentity saidThat solved my problem, thanks!
call once flush_rewrite_rules() . BF
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.
