Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to wordpress. I searched

page vs post

and found that pages are mostly static contents (in the sense that they dont need to be changed and stays in its place for ever). My question is my site consists of lets say 20 pages. They are sorted into 4 categories so each category has 5 pages. I want to create one template for each category, the only difference would be the right side bar would contain some static links to the pages in the same category. Is there any easy way of doing it?

share|improve this question
add comment

2 Answers

First there are a bigger difference between posts and pages and in your case it would be that posts have categories and pages don't.

Anyway the simplest way to achieve what you described would be to create 4 categories, and use posts. use the same template for all categories but in your sidebar use category posts widget to list the posts from that category.

share|improve this answer
    
Do you think it would be any better if I use page instead. I am not particular about it but does it give me any significant advantage. My page is most static, one time thing, there will be no updates. –  Micheal Learns to Rock Jan 14 '12 at 16:50
    
I installed Category Post widget. What I see is it will include one one selected category post on template. Does that mean I have to create 4 templates? –  Micheal Learns to Rock Jan 14 '12 at 17:05
    
no need for that, you can create the same widget 4 times and each time show a different category, and use something like widget context plugin or widget logic plugin to display only the relevant widget. and as for your pages being static it make no difference if its posts or pages, so just use posts since they have categories :) –  Bainternet Jan 14 '12 at 19:20
add comment

You said you wanted to create a "template" for each of the 4 categories. Creating a page template may be a little more technical than you're ready for if you're just getting started with wordpress, but that depends on your coding knowledge. How comfortable are you with HTML, CSS, & PHP?

Also, if you're interested in creating real page templates to use with your theme, it's a good idea to learn how to create a child theme and add them that way. Child themes allow you to customize your theme without modifying any parent theme files. You can find a good introduction to child theme basics here.

In addition to that, another solution to creating the structure you want would be using pages and custom menus like this:

  • Parent Category Page
    • child page 1
    • child page 2
    • child page 3
    • child page 4
    • child page 5

You would then need to create the navigation menu you want to show up in the sidebar in Appearance > Menus. Create 1 menu for each category, then use the Custom Menu widget to add each menu to the sidebar. Then you just have to set each one to only display on the pages where it should show up. Install and activate the Display Widgets plugin. This allows you to choose what page to show/hide each widget on. Once activated, in the admin Widgets page you will see on each widget in a sidebar has an added section (once it's expanded) where you can set the Display Widgets options.

This method is a little more complicated and will take a little more time to setup than the first answer, but it will make customizing your pages easier as not all themes have different layout options for posts.

Hope that helps!

share|improve this answer
    
That makes sense. I am proficient in HTML, CSS and PHP but I would not use any of these if a ready made solution is available, the one @Bainternet has suggested. That is not a complete solution though (what I have tried so far). –  Micheal Learns to Rock Jan 14 '12 at 18:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.