How to Display categories in different pages
Hi, Im new to WordPress, and I was wondering if its possible to display different categories in different pages, for example if you have one page with your blog, and want to have another page displaying another categorie ? What would be the php code to get that outcome ? Hope someone understands this 🙂
So you want to have list of categories type A on one page and then when you click on another page, only show list of categories type B?
Do you want this to be on posts within a specific category or specific Page or a list of categories that are different dependent upon the category page you are viewing? Lots of options. Here are some resources, depending upon what you want to do:
Well, you can always link to each category. There’s:
1 represents the numeric ID for the category you want. Or if you’re using custom permalinks, it will be something like:
But if you’re trying to set up an external PHP page to do this (for some reason), first you’d need to make it WordPress aware. Basic instructions are here:
(Except for step 3 you do want The Loop.) From there you have at least a few options on restricting posts to one category:
$cat = 1;
just before the require line for wp-blog-header.php.
2. Use this just before the start of The Loop in your page:
<?php query_posts('cat=1'); ?>
Thank you for your help I will probably be able to use this to find some solution even though Im not really experienced in PHP.
My idea was to use WordPress and display everything from categorie A on a page wich will only contain news wich are marked with this categorie and then have a different page only showing what I mark as categorie B. For example when you click a link on my page called football, you get all the news that I have put under a specific categorie and then when you click on a link called cars you only get the posts I have marked under that categorie, therefore letting me use on blogmanager to maintain multiple pages.
So isnt “Well, you can always link to each category. There’s:
/?cat=1″ this the easiest solution???
Using WordPress’ builtin functionality is always the easiest solution.
Did you figure it out. That’s what I’m trying to do…hope so..
takeiteasymama: see the links mentioned in the first response. They will take you step-by-step through the process. It’s VERY easy.
Im trying to do a similar thing. The way I see it, and tell me if I’m going along the right lines here. Is that the terminology used to describe a Page, is quite difficult. You see, my site will use what I consider as different pages, ie home, tutorials, scripts, photographs. Yet these can actually be created as categories, and still have the same effect as pages? The only problem is that I want the links to my so called pages at the top of the site, and then that pages sub categories in the sidebar. Because they will technically be two category tags in the one page, is this possible? or are you only allowed to call one category tag?
It takes a while to get your head round what I’m trying to say, but the fact is that the use of WordPress is only limited to your imagination. (almost)
Am i thinking correctly here?
If we are talking about Pages (see the definition of Page with capital P in Codex 🙂 – those do NOT have categories. Pages can have children and parents, but they are not in the category “tree” of the posts.
Edit. The closest to what was asked in the title of this thread would be the category template. You can have different looking webpages for categories, based on category templates. You can read about it in the codex, and here is a success story of working cat. templates.
Thanks, I read the codex on the definition of pages and Pages. :S lol.
Maybe it’s just me, but i think that if your someone that hasn’t used WordPress before it takes some time getting your head around the process of building a site using WordPress. As WordPress is as the name suggests a blogging tool, more complex sites can be hard envision how one might create such a site.
However having said that, once you get your head round it, and realise that you just use different category templates for each type of different page, you begin to realise it’s reasoning. Because the beauty of WordPress and other CMS tools is that it generates the content automatically, using includes and other dynamic data processes, it’s actually reletively simple to create. (In theory, im still yet to find out)
I just thought i should mention this, because not all designers realise this, it took me a good few hours to suddenly click. I’m always learning how WordPress actually processes everything.
- The topic ‘How to Display categories in different pages’ is closed to new replies.