If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.
July 2, 2012 at 6:37 pm #13860
Hey Kriesi & team.
Since building my site last year, I’ve only ever had 1 single Portfolio page, Features:
However, I’ve decided that I also want to add another one, Case Studies
The problem right now is that even though (I think) I’ve set up the Portfolio Prefs correctly…
…each Portfolio page displays the categories for ALL portfolio items:
Show: All | Case Study | Code | Designer | Developer | Organisation | UI
Is this how it should be? And if so, what PHP do I need to add to template-portfolio.php to limit each page to its chosen categories?
DaveJuly 2, 2012 at 7:14 pm #80923
Do you by chance have “Portfolio” selected under Template when you click on Pages > Case Studies? If so, set that to “Default Template” then refresh the page and see if that works.
MyaJuly 2, 2012 at 7:36 pm #80924
Brilliant! Thanks Mya, that’s the last thing I would have thought of.
It seems a little counter-intuitive though, as the page is clearly using template-portfolio.php. Does setting the portfolio template instruct the page to use ALL items in that case?
Also, I’m not quite sure what “Enter a page slug that should be used for your portfolio single items” means, now I have 2 lots of portfolio pages.
DaveJuly 3, 2012 at 6:50 am #80925
Yes, portfolio pages are using the template-portfolio.php. If you choose Template > Portfolio it will override the settings on your theme options and will show all of your portfolio items with the default settings 3 columns.
This code in template-portfolio.php is responsible for that one.
//set a deafult query with all portfolio items in case the user just selected to display the page tempalte instead of stting up a portfolio properly
if(!isset($avia_config['new_query']['tax_query']['terms']) || $avia_config['new_query']['tax_query']['terms'] == "null")
$avia_config['new_query'] = array("paged" => get_query_var( 'paged' ), "posts_per_page"=>-1, "post_type"=>"portfolio");
When you enter a slug, it will add that slug on the permalink for each portfolio item.
IsmaelJuly 3, 2012 at 6:57 am #80926
The portfolio slug option allows you to customize the permalinks for portfolio items a bit. Eg many users don’t want to call their portfolio entries “portfolio-items” but the (standard) slug suggests this name. Eg you could insert “projects” instead and then the permalink will be my-website.com/projects/your-single-entry-name instead of my-website.com/portfolio-items/your-single-entry-nameJuly 3, 2012 at 7:55 am #80927
Thanks for the info. I actually realised yesterday what the slug was about once both my portfolio sections linked to portfolio items with the same leading slug segment.
My suggestion for any Broadscope update would be to allow the user to select a slug per-portfolio page, i.e.:
And they could always just type the same slug if they wanted a global slug, like:
Anyway, thanks for getting back to me. I might try and think how to hack this one, but for the time being, I have the separate portfolios working, so that will do!
DaveJuly 3, 2012 at 8:32 am #80928
The topic ‘PHP code for separate portfolio pages’ is closed to new replies.