Need help with a post-pulling operation
All right, so here’s my problem. I’m doing a website for a local organization with WordPress as a low-level CMS, which is what they need.
On one of the things they want is a ‘Projects’ tab. This is really easily done in WordPress with pages and archives. MY current approach is to have a page called Projects that uses a plugin to redirect from the page slug (
/projects) to the
/category/projectsslug, which shows the listing for a hidden “Project Listings” category. As you can probably guess, this is less than ideal. Because it shows all of the junk associated with an archive.
I’ve read up pretty well on custom pages, and I’ve found (well, not found, really, but you get the point) that I can put something custom for a page. I’d like to know how to pull the posts from a specific category and display them almost exactly as they do in a category archive, except without “Edit,” Rolling Archives in themes that support them, and the post meta.
I’ve toyed with query_posts and have screwed with the loop, but I only end up pulling in an endless “loop” of the first post entry, loading the query indefinitely. I’m not really used to PHP, so how would I go about this?
If you don’t want the “Edit” or other post meta that comes with your theme, I’m afraid you’ll have to customize it all out of the theme templates.
Why don’t you use a static page for the splash page, and save all your posts for your category projects page rather than redirecting to an archive page?
In Dashboard–> Settings–> Reading–> you can set the site so the front page displays one page (“Home” or whatever). (I think you already figured this out as you say in your query.)
But if you set the Blog Posts (all posts in the Projects cateogry) to another page (called “Projects”), then the Projects page will not appear as an archive, but as a regular posting page, subject to the more tag or the excerpt or full post depending on how you set it up.
Any time you call wp-list_pages, “Home” and “Projects” will appear, with direct links to those pages and no need for a redirect. I use this setup on a few non-profit CMS sites I help out on.
And I hope I didn’t misunderstand your question — I really shouldn’t post in the forums after I’ve downed a margarita.
Yes, alcohol is never good. Not very helpful, “Projects” needs to be a separate page that acts like an archive without all of the extra crap. I already know that I need to create a different theme template. I do not want Projects to be the home page. Thanks for helping, though.
No — your home page would be “Home” or whatever page you choose. Your “Projects” page would not be the home page.
Your “Projects” page would be the non-home page containing all the blog (project) posts you wanted, just like an archive, but without the extra “archive” stuff, and without your having to use redirects.
The home page would be separate from the Projects page. Sorry I wasn’t clear.
Oh, well, that helps some. But it’s not the situation I’m trying to get done. I want to pull the post loop in the make things appear as they would in the archive. I can do the rest myself. How do I just do that? What template/page do I need to duplicate?
All right, I’ve read up on it a little more. I can pull the loop by myself, and have read up on query_posts. I just want to have my custom page template pull an archive query as if I were on a category archive. So, what variable do I set to give WordPress a category ID so I can then include the loop?
- The topic ‘Need help with a post-pulling operation’ is closed to new replies.