Grow your CSS skills. Land your dream job.

WordPress post loops for one category

  • # June 22, 2009 at 3:12 pm

    I want to add a tutorials section to my existing site. http://www.harfordhackerspace.org

    I started off by creating a new page but I don’t think that’s what I want. I really don’t know what I need which is why I am asking you guys.

    I would like to create post which contain my tutoials and have a link to a ‘page’ (if that’s the correct term) that displays only those post in a certain category. I know that get_post(category=3) will do what I need but I don’t know where to put that code so that I can add a link in my menu for the ‘page’.

    I hope I did not confuse you with my rambling so far. My thoughts are that I need to edit my theme file and do an IF check for the Tutorials page name. Then create the tutorial page as a wordpress page. Inside the IF statement I then run the get_post template tag.

    Can someone tell me if I am on the right path? Should I be editing the page php template file or is there another method to handling something like this?

    # June 22, 2009 at 5:31 pm

    The gist of what you’re doing:

    1. In your editor of choice, create a new template that only displays posts from the "tutorial" category. You can probably take the loop that’s on your index page and modify it to only show tutorial posts, probably the easiest way.

    2. In WP, Create a page called "Tutorials", select your template made in step 1

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".