WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Display content on a specific level category and on their parent

[Resolved] Display content on a specific level category and on their parent

  • Hi everyone.
    Does anyone know how to display content on a specific level category and their parent? I found a few close solutions but none of them works for my case.
    Here’s the situation i have:

    Main category
    |—-Submenu1
    |—-Submenu level 2
    |—-Submenu level 2
    |—-Submenu level 2
    |—-Submenu2
    |—-Submenu3

    I would need for content to be shown just on Submenu level 2 and their parent (Submenu1). And since the categories are dynamic (more can be added over time) – I can’t use targeting specific category ID.

    I would appreciate any help :).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Can you just add the content in a custom field for each post that needs it? Then you can just edit the template file to check if there’s a value for a specific CF key and pop it in where needed. If there’s no value then nothing shows up.

    If the content is to be the same on each page then you can just create the content in static page, and on each of the pages that need that particular content to show up on just create a custom field called ‘content’ with a value of ‘true’. In you template file you can check if the meta key ‘content’ has a value of ‘true’ and if it does then you run a query to fetch the page_ID that contains the content.

    Hey Denis, thanks for the quick reply!
    You gave me a great idea – I used description field and, as you wrote, checked in template for specific value. That pretty much solved my problem.

    Thank you, again, for your help 🙂 !

    Didn’t think of that one, yeah that should work. The only drawback is not having the editor to work with.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Display content on a specific level category and on their parent’ is closed to new replies.
Skip to toolbar