611 posts Don't be so humble - you are not that great.
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Helped protect Envato Market against copyright violations
+5 more
plusquare says

Hey guys,

I could use some help here. So I have a custom post type portfolio and an archive-portfolio.php file with /* Template Name: Portfolio */ on the header. Does this prevent wordpress from choosing this file for displaying categories, it works good when I add a normal portfolio page but when I try to go to a category it goes for archive.php instead.

I’ve already tried to remove template name but still it doesn’t work, and yes I have

'has_archive' => true

in the post type register :S

Thanks for any help guys

647 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
ChapterThemes says

Is the post type also exactly registered with the name ‘portfolio’ ?

The template file needs the extact name of the post type, including prefixes

611 posts Don't be so humble - you are not that great.
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Helped protect Envato Market against copyright violations
+5 more
plusquare says

Thanks for your reply, yes here’s the post type register:

register_post_type( 'portfolio' , array(
        'label'=>_x('Portfolio','Type','pqportfolioposttype'),
        'description'=>__('Special type of post for creating work','pqportfolioposttype'),
        'labels' => $labels,
        'public' => true,
        'menu_position' => 5,
        'show_ui' => true,
        'show_in_menu' => true,
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'query_var' => true,
        //'menu_icon'=>get_stylesheet_directory_uri() . '/images/portfolio_icon.png',
        'rewrite' => array("slug" => "portfolio"), // Permalinks format
        'capability_type' => 'post',
        'hierarchical' => false,
        'has_archive' => true,
        'supports' => array( 'title')
        )
      ); 
611 posts Don't be so humble - you are not that great.
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Helped protect Envato Market against copyright violations
+5 more
plusquare says

And the taxonomy:

$taxonomy_portfolio_category_args = array(
    'labels' => $taxonomy_portfolio_category_labels,
    'public' => true,
    'show_in_nav_menus' => true,
    'show_admin_column' => true,
    'show_ui' => true,
    'show_tagcloud' => true,
    'hierarchical' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'portfolio_category' )
);
register_taxonomy( "portfolio_category", array("portfolio"), $taxonomy_portfolio_category_args);

Any help would be amazing :S

709 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+2 more
ChillThemes says

Copy archive.php and rename it to taxonomy-portfolio_category.php

611 posts Don't be so humble - you are not that great.
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Helped protect Envato Market against copyright violations
+5 more
plusquare says

Thanks so much for you answer that got it to work :)

Cheers

709 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+2 more
ChillThemes says

You’re welcome, happy theming.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by