Display specific post category on page
Love this theme. I have created posts in specific categories. i want to display these posts on a page other than my blog page. Sort of like a product page I suppose. I have created a child theme. I believe I have to create a new template that includes code such as this
If category = category id1 then
display posts in category id1
else if category = category id2 then
display posts in category id2
display ‘category not found’
My question is what template would I copy and where would I put this code in that template.
My website displays information about certain restaurant specials and i want to be able to display the specials for monday or tuesday or wednesday….etc depending on sub menu item the pick.
Is there a way to incorporate that into the code as well?
Here is my site
Thanks in advance for your help.
I am pretty much a newbie to wordpress and themes. I did create a child theme. i don’t see a page.php file. I am pretty confused with the whole template part thing. Here is what I would like to do.
I would like to have 7 sub-menu items under my main menu item that displays posts from my Monday category, tuesday category, wednesday category, etc. Do I have to create a separate Monday page template, tuesday page template, etc to accomplish this? Also, would i need a 7 separate loop files to place the query-posts template so i can filter out all other posts but the one I want? Maybe you could just give me short idea as to which path to follow on this. Thanks for your help.Mod
Maybe it is not and different and I am confused. LOL some background. I have created single posts for each bar with a happy hour. if a bar has a happy hour on Monday i have put it in the Monday category, etc. Now I want to have a sub menu item named Monday under a top menu item named Happy Hours and then have that page display all the posts under the Monday category on a page.
Another example is if I were on a product website and they had a menu item named cars and a sub menu item named compact. If I select compact then a page of all compact cars displays.
Am I making this more difficult than it is? Thanks for responding. I have beating my brains out with this. I have looked at plugins, code snippets, etc. I see code that i think will work but i can’t figure out where in this theme to put it since there are so many template parts.
Here is an example of some code i saw to display all posts in category 38. Thought this might work but have no idea where to put it and how to implement it.
<div><?php the_content('Read More') ?></div>
Am I making this more difficult than it is?
Yes, you may be. What you really want to do is to create a custom menu, using categories. With a custom menu you can arrange things exactly the way you are talking about.
Read this tutorial on custom menus and give it a try. I think it’s what you are trying to achieve:
Thanks for the tutorial KJ Odle. I have read this and thought about doing it this way. It gets me close but it is not quite the way I would like unless there is more I am missing.
I have a home page and a blog page. It is my understanding that the blog page displays all posts.
My website is used to find happy hour information at bars/restaurants.
I have two, lets call them styles, of posts. One style is where I blog about the happy hour after I attend it. The other style of post is strictly information about the bar/restaurants happy hour (picture of bar, happy hour times, prices, etc.)
I want only the critique style posts to show on my blog page. I want the information style posts to show an another page called happy hour listings. The critique style posts are in different categories than the information style posts. I thought by doing this I could display the different style posts on different pages based upon the category. Critique style posts on blog page. Information style posts on happy hour listings page.
Can I accomplish this using the custom menu as you have suggested and I am somehow not understanding that? I have created a custom menu and I can get the information style posts to display on my happy hour listings page. What I am unable to do is keep the information style posts from showing on my blog page. Do I need to go into the code in order to exlude the information style posts from displaying on the blog page? Is there a good plugin to accomplish what I want?
Sorry for the long reply. I hope you are able to decipher this post. Thanks again for replying and helping. It is really helping me learn more about WP.Mod
If I understand you right, you can do this by assigning the various posts to categories, and then either using a category archive (no need to include the code you have above, because it already sorts things by category), or to create a page and then use Kalin’s Post List plugin to include links to the various posts in the category.
The advantage of the former method is that you need to do nothing, except create the appropriate categories and assign posts to them. The disadvantage is that you can only display posts from a single category at a time.
The advantage of of the latter method is that you can include posts from more than one category, but the disadvantage is that it is a bit more work to set up. But only a bit more. I have a tutorial for Kalin’s Post List plugin on my blog that will help you out.
You must be logged in to reply to this topic.