Use a wordpress page to display a certain category

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.

Read More

Is there a way to set up my page so that it shows the posts in the category portfolio the way I want?

Related posts

Leave a Reply

3 comments

  1. 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..

  2. 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:

    if (have_posts()) : while (have_posts()) : the_post();
    

    Find that piece and add this code just right above that code:

    query_posts('cat=3&paged='.get_query_var( 'paged' ));
    

    Things to note from above query_posts snippet is:

    Hope that helped.

  3. 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.