[Support request] conditional categories

Home Forums Support [Support request] conditional categories

Home Forums Support conditional categories

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #2333752

    Hello, I have one single post that is in different categories and shows on different category-post-pages (I used to do this with “wp-showposts, now I use generateblocks for category-post-pages). On the single post I would like to have a return link to the category-post-page from where I got to the post. As the post belongs to many categories it is impossible to create this link. Is there any other way (thinking of the flexibility that comes with generatepress), than to use a plugin – or is there a simple, slim plugin for the task? Thanks Klaus

    (There is a half naked girl as my avatar, sorry for that, I did not create that…)

    Customer Support

    Hi there,

    well thats tricky, can i see one of your Category pages ?


    So here it is:


    I have created an element on top of the page, that you find also on every single-post of this category. This top-element comes with the read-more-link.

    So the plan is:

    The same single-post content (beneath the top element) would show, in another category, with the top-element of this other category, with the link to this other category-posts-page. I have a feeling, that it is not impossible to do that, somehow. It is not even “conditional”, is it?

    The problem as it is:

    I can have two category-posts-pages and each has a top-element (that I use for the read more link). As one single-post has two categories selected, that’s fine. The single-post-exerpt will be displayed on each of the two categories-posts-pages.

    But for the display of the single-post now, when I select two categories for the single-post, two top-elements of the two selected categories will be displayed, as I can already choose in the backend, where the top-element is displayed. My design at the moment keeps me from selecting two (ore more) categories for one post, as the structure of my design would get distorted.

    I think of something like: If top-element of the categories-post-page is “1” and single-post is from category “1” or “2” then display top-element “1” on the single-post and hide top-element “2”.

    Or like a breadcrumb-navigation: if the breadcrumb-navigation is from categories-post-page “1”, show top-element “1”, if it is from categories-posts-page “2”, show “2”.

    Customer Support

    In your top-element for the single posts.
    If you add a GB Headline Block, and enable its Dynamic Data, and set it to Display: List of Terms.
    Then this should generate the category archive link for you.

    as you’re using static pages, you may need to make a redirect for those links.
    And on the posts where there are multiple categories we can look to display only one of them.

    Is that a solution ?


    Hello David, yes, I changed the top-element for this one category to Dynamic Data. So how could I hide the displayed second top-element?

    (I have selected one post for multiple categories, now – sorry – you would have to kindly help me along…)

    Categories-post-page: https://honigwerk.de/soda-fuer-haushalt-und-pool/

    Single-Post in two Categories: https://honigwerk.de/soda-aetznatron-natron-nicht-verwechseln/

    You can see the dynamic data with the two categories displayed, and the second top-element for the other category as well (in this case it is not dynamic yet).

    Problem as it is: I would like to stay within one category, coming from the categries-post-page (with the one category’s top-element-link). Coming from the other categories-post-page, I would like to stay within this other category (with that category’s top-element-link).

    Customer Support

    So if i came from:

    https://honigwerk.de/reinigung-und-hygiene-am-bienenstand/ the single post will show only Reinigung & Hygiene am Bienenstand

    And if i came from:

    https://honigwerk.de/soda-fuer-haushalt-und-pool/ the single post will show only Soda für Haushalt und Pool

    So it only shows the referral category. Is that correct ?


    Yes, exactly. I am breaking my head, but have no idea….

    Customer Support

    Although it would be possible to check the referrer URI ( $_SERVER["REQUEST_URI"] ) against the term slug. And remove the ones that don’t match. You would have a problem if there no referrer eg. the user was linked to the post from elsewhere.

    Your choices are to:

    a. show ALL term links,
    b. show just the first term link,
    c. or if you’re using Yoast display the Primary Term link.
    d. employ a developer who knows this stuff lol 🙂


    Bad news. But o.k.

    What if I duplicated the content: is there an elegant “dynamic way” to duplicate only the page and draw its content from a commen source?

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.