Support » Themes and Templates » How to show only one categories posts on page?

  • Resolved sealyspeak


    Hi All,

    I am trying to create a category loop based on the code I have paste binned , which I can control so if I make a News page, it ONLY displays news posts. If I make a Books page, it will only display a book post, etc…

    I am using Mystique theme, latest updated version extended and I am not getting anywhere fast.

    What I need to do is create a category-news.php as a template for my page, a category-book.php template, etc… but using the code attached from Mystique. I just can’t figure how to do t?

    I did try “Pages link to” plugin, which was NEARLY perfect. It just didn’t show in the navigation bar that I was actual on that page.

    I am new to this, so any code examples based on my code would be great!


Viewing 8 replies - 1 through 8 (of 8 total)
  • The usual way of doing this is via Category lists. That way, you don’t have to mess with the code.

    See Urban Words for an example of a site that uses several category lists (e.g. Residencies, Consultancy, Blog).



    I posted the wrong code in my first post! Sorry, was a long day yesterday. Below is correct:

    Thanks peredur, I know about creating category lists, it’s just trying to get 4 pages (within Mystique theme) that will display ONLY the category I want them to. The pages need to sit in the main navigation alongside normal pages. I did try “Pages link to” plugin, which was NEARLY perfect. It just didn’t show in the navigation bar that I was actual on that page.

    I am pretty sure I need to write a custom category.php for each page template. Can anyone help?

    I am pretty new to this…

    Category lists do only show the posts in that category. You just have to remember to allocate the category when you create the post. The urbanwords site I linked to before has categories for Consultancy and Residencies, for example, on which are listed just those things. So if you wanted to have a list of posts on the subject of ‘the 1950s’, you just create a category of (say) ‘1950s’ and allocate it to all your posts that deal with that period. Then, in your main menu (which you will have to create and allocate as the site’s main navigation menu as explained in this article) you simply add the category lists to the menu so your user can access them.

    I’m not sure what you mean about separate domains. A domain means something quite specific to me.

    Of course this means that you create posts and not pages. Only posts have categories. But this is the usual way that it’s done. The idea is that you take advantage of WordPress’ built-in functionality rather than trying to code it all up yourself.



    Why not just create a menu item that links to the desired category page?
    Or am I missing something here?

    See further up the thread. It was my first suggestion.



    Many thanks to you all for your help, I was by all accounts trying to reinvent the wheel with this post question. I was attempting to write specific category templates that did not need to be written as WordPress (and peredur & digitalnature) and the fantastic theme do this for you!

    Ahh! The problem was I was working through some tutorials about calling in specific categories and tried to apply them to Mystique. What a waste of time.

    I have a new post about Mystique, but this time it is a real one…

    Having the same problem here but you won’t share your insight with us??


    Blog is this:

    Moderator Andrew Nevins


    Create your own thread if you’re having the same problem. This discussion ended 11 months ago.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to show only one categories posts on page?’ is closed to new replies.