• I am encountering a common scenario with my clients. I build their sites with WordPress. Usually this is mostly Pages, and then a News page which acts as a normal WordPress blog (post stream, category widget in rail).

    Recently I have clients who need a post stream on multiple pages. That is to say, they might have a News page, a Vacancies page and an Events page.

    To my mind, you would add a post in a category of News, Vacancy or Event. And then for the News, Vacancies and Events pages, you could tell WordPress the page should act like a Blog BUT be restricted to categories I choose.

    The closest I have found to making different pages list different posts (and which many themes appear to use) is Custom Post Types. But this is not quite right (or rather, not quite as easy as it could be). Yes, I can create 3 custom post types for News, Vacancy and Event and not use categories at all.

    But the thing being, I need to use categories. E.g for a category of Vacancy you would have sub-categories of Internship, Full-time, Part-time. For Events you would also have sub-categories.

    On a Page acting as a Blog that filtered automatically to the category of Vacancies, the categories widget should also be limited to that category and its descendants so the user can filter among the posts.

    In a custom post type strategy I would need to create 3 separate post types that come out and are managed in 3 separate areas in admin. I would then need to create 3 separate page templates each with it’s own WP_Query to select the appropriate post type. And then I could not use the category widget easily to allow in-page filtering of sub-categories of the custom type.

    I hope I have explained the requirement I am coming up against again and again and I wonder if more advanced users here have suggestions for a development/configuration strategy.

    best

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m not sure if there’s a more elegant way to do this, but I have done what you are describing by making custom page templates for those categories (Custom Page Templates https://codex.www.ads-software.com/Pages#Creating_Your_Own_Page_Templates) and then changing the loop to query only the category that I want (query_posts() https://codex.www.ads-software.com/Function_Reference/query_posts).

    I guess you could also do it with one page template and conditional statements, but for my purposes, separate templates for the individual categories has always been easier.

    HTH…

    All you have to do is create a custom menu which literally gives you the option of making a category a page.

    I hope that doesn’t seem to simple an answer. I may have misinterpreted what you are trying to achieve, but I’m fairly certain I had the exact same problem and I overcame the problem via the correct implementation of a custom menu.

    If you check out my website: gamedeals.co.za , you will see that my posts filter into different pages within the site, based on the category selected when I publish the post.

    I was thinking of creating a post about exactly how to do this, purely because it’s useful to know, fairly easy to achieve, and yet the documentation on how to do so is not readily available in any section of the word press codex help sections.

    You can also contact me at [email address removed] if the functionality that I have achieved with my site is indeed what you’re after and you’re having difficulty integrating the custom menu into your site.

    Kind regards,
    Richard

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Strategy for pages with posts’ is closed to new replies.