I’m trying to set up a portfolio page on my wordpress website, and I would like the following construct:
- /blog/ where I blog all kinds of things, including portfolio entries
- /portfolio/ where I show just posts from my portfolio category
- some regular /pagename/ pages (about, contact, etc)
I want the portfolio section to have a separate style (and even html probably) than a regular category overview. So if someone clicks one of the categories in my blog they still see the normal /category/randomcategory/ overview page. This means I can’t just change the category php page and/or the css, because the portfolio page is different from the regular view.
Is there a way to set up my page so that it shows the posts in the category portfolio the way I want?
The page of posts example pulls posts from one category, it uses a custom field to designate the category, which in turn makes the page template re-usable on other pages with other categories to, if you so choose..
You can style that template however you like..
Hope that helps..
First, you will need to create custom page template. Refer to this page to see how to create it.
Second, on that page (you can copy from your page.php/index.php, the important part is:
Find that piece and add this code just right above that code:
Things to note from above
query_posts
snippet is:Hope that helped.
take a look at http://codex.wordpress.org/Template_Hierarchy .
You can see in the category template section that you can use either category-10.php or category-portfolio.php (in case your portfolio category id is 10 and the slug is “portfolio”) to override the default archive.php file.
This way, you can customize the HTML/CSS in the new file you create and it will have an effect only on the portfolio template.