It is possible to directly link to one project type, but still maintain the portfolio masonry layout? I know I can view a single project type, but that shows up in a list. I’d like to link directly to a project type, but show it in the portfolio masonry layout.
Ok, you can try this: open the theme folder, copy the file “portfolio-masonry.php”, rename if to “portfolio-masonry-2.php” and put it in the theme folder (where the portfolio-masonry is located). Now open the new file ( portfolio-masonry-2.php). Go to line 2 and replace this:
/* Template Name: Portfolio masonry */
/* Template Name: Portfolio masonry 2 */
Now go to line 46 and replace this:
query_posts(array( ‘post_type’ => ‘portfolio’, ‘paged’ => get_query_var(‘paged’), ‘posts_per_page’=>$post_per_page ));
query_posts(array( ‘post_type’ => ‘portfolio’, ‘paged’ => get_query_var(‘paged’), ‘posts_per_page’=>$post_per_page, ‘project-type’=>’insert_here_the_name_of_the_category’ ));
Please replace in the code above the ‘insert_here_the_name_of_the_category’ with the name of the category you want to show.
If you want, you can insert also the random post order to the code, like this here:
query_posts(array( ‘post_type’ => ‘portfolio’, ‘paged’ => get_query_var(‘paged’), ‘posts_per_page’=>$post_per_page, ‘project-type’=>’insert_here_the_name_of_the_category’, ‘orderby’ => ‘rand’ ));
Forgot to say: as soon as you are ready with the changes, create a new page and choose “portfolio masonry 2” as template…
So I would need to do this process for every project type? I have 15 different categories. There’s no simpler way to directly link to a project type?
I am sorry, but I was mistaken, I am not using Portfolio masonry, I am using the template Portfolio sortable. Is there any way to directly link to a project type in that template?
See screenshot… I want to link directly to a project type tab in the portfolio sortable template. Is this possible?
Should the other tabs remain visible? You can try this: please go to line 46 in portfolio-sortable.php and change it to this code:
query_posts(array( ‘post_type’ => ‘portfolio’, ‘paged’ => get_query_var(‘paged’), ‘posts_per_page’=>$post_per_page, ‘project-type’=>$_GET[‘ptype’] ));
Now you can add the category to the URL, for example:
In WordPress admin -> Appearance -> Menus you can add custom links to your menu, just add the links to the page with the sortable portfolio template and add to each of the link the extra code, .i.e. &ptype=photography or &ptype=webdesign
That sounds like exactly what I need, but I can’t seem to get it to work.
My gallery page ID is 16.
I have tried:
It just sends me to the homepage. Not sure what I’m doing wrong.
(And yes, the other tabs should remain visible. I just want to be able to say “View our picket fences” and link directly to the gallery with only the picket fence pictures showing. 🙂 )
Hm, strange. Can you send me the link to your website, then we can controll the header output and discover the problem
Ugh, I figured it out! When I copied your code from this page, it pasted “curly” quotes instead of “straight” quotes, so the code wasn’t being parsed properly. I corrected it and it is working now.
The only trouble is that the tabs don’t work when I link directly to one tab. So I either need to have the other tabs work properly, or have them not display at all. Any ideas about that?
Here’s the link.
Ok, I know what you mean, but that’s not so easy. We will test it and as soon we’ve found a solution we will post it.
You must be logged in to reply to this topic.