list posts by category on a page
-
I created a Page and on that Page I want to list all posts in a specified category. How do I do this?
-
You don’t. Pages are not for displaying posts.
Just click on any category’s name and all the posts from it will be displayed. If you want to style that listing differently – use Category_Templates.That brings up a new problem. I can’t allow users to comment just on the new category-template.
I need to create a page that will allow users to leave comments on that page and I need to list all posts in a category.
How do I get both of these on a page?
You are absolutely wrong.
1. Even if it was possible to list the posts from one category on a Page – you still can NOT comment on anything except single post view. Period.
2. In the so-called multi-post views (index, monthly archives, category archives) nobody comments: the comments template cannot be displayed because it has to be attached to one single post’s ID.
3. So, don’t push the Page issue because it will not solve whatever you thought it would.
4. Learn how WP works and use the features in your advantage, instead of trying to force WP to do things in the abnormal way…I DO have comments running on “pages”. So that does work.
Forcing WP to do new things and display content in new ways is EXACTLY why WP is good. If every site displayed content the same way it would make the internet boring and leave no room for improvement of content distribution. Displaying content in new ways is what makes certain sites better than others.
Where can I find coders to do some custom work to make this work the way I want it to?
I DO have comments running on “pages”.
Yes, sure: for that one content entry that is displayed in the Page. Not for ten entries or a hundred…
And if you know better then don’t ask.Join the wp-pro list:
https://lists.automattic.com/mailman/listinfo/wp-pro
for paid jobs>>I DO have comments running on “pages”. So that does work.<<
he’s not disputing having a comment listing on a Page cannot be done. he’s saying to you can’t have comments for multiple things – like an entire category, or the archives. The individual posts/Pages you can. When he says you can’t comment on anything except the single post view, he’s right (posts, in this case, also qualify as a Page – because it’s a *single* post he’s referring to).
Maybe if you told us what you were trying to do, you’d get an answer that would actually help? What I gather is that you want a single Page that lists posts from a particular category. Now, you *can* do that – but it’s easier to just make a category template file and add your static text above it.
Are you trying to make it so people can comment on an entire *category* and you’re trying to fake it? If that’s what you’re after, then yeah, you can do that by creating a static page, and then calling in a custom query to pull in a certain category into the page, and then adding the comments stuff on that Page.
i.e. create a Page titled “state trees”. You already have a category called “trees” (category ID of 5) that you can post to. However you want to fake commenting on an entire *category* rather than individual posts – so you’d create a template file called “state-trees.php” and put in your code to pull in the header. but then you’d have to use a custom query to pull in all the posts from the one category (like query_posts=(‘category=5’)…then start your loop), then at the bottom of that file you add in your comments stuff.
When that page is pulled up, it’ll use the template you made, and show the title and any static content you want at the top, and then show all the posts in the “trees” category…and then finish up with the comments template (you’d actually be commenting on the *Page* – which is why I say you’d be faking it.)
The problem is that when you use a custom query like this, you “next page” and “previous page” links are broken. People will see the first 10 posts in that category, but you’ll have to figure out an alternative way for them to read older posts.
I don’t know if that helped, but it sounds like it’s what you’re trying to do. Just be aware of the consequences if you go that route.
I might possibly be trying to do the same thing – or maybe possibly in a similar but different way.
On my site – https://www.thepostcardsproject.com I have the categories of the posts at the top. The navigation under the logo is the ‘pages’ where I have one page called CATEGORIES. If you click on the CATEGORIES page, you see a list of all the POST categories.
So, I want to add sub pages (which this theme allows for – as in if you hover over the ABOUT page, you see PRIVACY POLICY)
Anyway, I want to make sub pages with the title of each post category
And, as alternative navigation, for each post category, be able to click on the page and have the titles for all the posts in that category on that PAGE.
So, under my CATEGORIES page, it would have USA, ENGLAND, FRANCE, etc as sub pages. And, when you click on say ENGLAND sub page, it would list all the titles of posts that are in the England POST category. Just the titles for now.
Acutually, you can see a demo of what I am planning on the site. For me, it is about making things easier for the user. I have had many people request it on that site. It might not work the same on other sites, but to each his own.. one solution does not fit all, but this is the solution I am looking for after a lot of input from many users.
Im sure it can be done… I am just trying to figure out how it would be done this way and I will keep researching. As for not being the norm.. oh well just because WP was not ‘made’ to integrate posts and pages.. well.. that is why there ARE plugins and upgrades.. some things work differently in some situations and its about experimenting and learning.
I believe I just found a plugin to do exactly what I was looking for
List Category Posts which sounds like it will list posts from a specified category onto a Page. So, I am going to experiment with this.
New to WordPress and pressing on trying to find what I need first then to see who has it working the way I would like.
And now etjohn, what you have on your site seems to eb what I’m looking for – a page in a category listing all the posts in that category. The same would be for a list of pages in that category.
Comments on those pages would not be necessary but it would be a quick and easy way for a visitor to get to any one of the posts and or pages in each category because of the list displayed.
If possible I would like that for each category the first entry point would be such a page listing all of the post/page entries in list form.
Is any of this possible or does a special template have to createdto do what you are planning with List Category Posts? Of course this will be difficult for me as I am only familiar with WordPress on the surface.
I found Customizable Post Listings Plugin but again it would need a lot of investigation.
- The topic ‘list posts by category on a page’ is closed to new replies.