• Hi,

    I’ve a query that i’ve never really been able to solve.

    I have several sections on my site (News, Recipes etc). These are basic pages. In these pages, i can add any short code i want to list a category of posts – ‘news’ for example.

    The logic is say i have a ‘News’ page on my site and it lists posts in the category ‘news’. You get the set up. Fairly standard.

    The problem is with breadcrumbs and other stuff related to posts ‘belonging’ to a certain section. A typical page URL as described above would be /news/ but when you click on a post in this page, you get /category/news/NEWS_TITLE. This not only destroys breadcrumbs (ie ideally you’d want ‘Home’ -> ‘News’ -> NEWS_TITLE) but also destroys other stuff like section colouring as this post has nothing to do with the page accept for the fact that its being listed on it!

    A typical example would be if i had my news page red say. When you click on a post it opens in its single.php view but there’s nothing to say that this post belongs to the news section – ie keep it red.

    I know some might say that you could use the URL ‘category/news’ to colour the section but this is very simple case. What if we were taking about a site that had 2 top page sections ‘Men’ and ‘Women’ and on it you had categories like ‘Recipes’, ‘News’, ‘Competitions’ etc. In this case both the men and woman pages would list recipes and news etc that were somehow related to the ‘Men’ or ‘Women’ (ie you could have a custom field in the page to select a category that this section would use) but if you click a recipe or news item, the category single page view would show and you might have either category/news/ARTICLE_NAME or category/recipe/ARTICLE_NAME – both have nothing to do with men or women so it’d be impossible to keep the post belonging to the section?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m not entirely following this but it seems like you could be getting what you need using more standard WordPress functionality. From what you described, I would’ve expected an Archives page to be used for the News category. You could customize a template page for each category (red for News).

    https://wpmu.org/how-to-create-a-unique-wordpress-category-archive-page/

    Maybe this doesn’t work completely if you have a complicated content structure but then you might be able to use a custom taxonomy instead.

    Thread Starter Developer ICAN

    (@richardicanie)

    Thanks a million for your response, i’ll take a look a this now!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Make a post belong to a page’ is closed to new replies.