• I what to do something that is not common and cannot find any hints that would lead me to right direction.

    I want to have a blog with few sections that should act almost like independent sub-sites.

    Actual content should be shared among sections but with option that user can select one section and while he is within section he sees content filtered for that section.

    My idea is to introduce custom taxonomy for sections, so for main site, all posts are displayed but for section only posts that are assigned to that section are displayed (same post may be assigned to several sections).

    What should happen when user selects section:
    – templates should be loaded based on section info, so visual looks of the section may be different from main site.
    – query var for the section should be set so that it could be used for altering content based on that value
    – queries for posts/archives should follow section info to filter out content that does not belong to section.
    – all urls on page should contain section info so that user stays within section as long as he does not select different section

    At first sight this seems like multisite but it is not. Posts and some other content is shared among sub-sites so everything should stay within same site.

    Main issue I see is generating URLS. I would like to have url of the site in form https://www.domain.com/section/rest-of-the-url but I cannot find a way to insert section part in every single internal url on the site and fix all already created rewrite rules to comply to section part.

    As I am working on non-commerical site, I have no budget so I prefer nonpaying solution even if it means i have to do programming.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    A custom taxonomy is a good choice. Your URL structure should have one extra element so requests are not confused with hierarchical page requests. The extra element would be how WP will know which taxonomy to query for. For example:
    example.com/section/food/carnitas/
    The “section” element is always the same, followed by the desired taxonomy term name, “food” in this example. “Carnitas” would be the post’s name which has the “food” taxonomy term assigned to it.

    You can define a custom rewrite tag so you can use it in defining your site’s permalinks. This only works for posts. For custom post types you’d add a custom rewrite rule to handle section requests.

    How you alter the permalink WP uses depends on the post type. For posts it’s best to use permalink settings, but you can instead use the “post_link” filter. For custom post types, use the “post_type_link” filter instead.

Viewing 1 replies (of 1 total)
  • The topic ‘How to make sections of a site as subsites?’ is closed to new replies.