• Resolved TomJohnson

    (@tomjohnson)


    I want to add several options for users to select that will then control the content shown.

    Specifically, I want to add options at the top that say “Select your programming language: .NET, C++, or Java.”

    If a user selects Java, than all content on the site with a class of dotnet or cpp should be hidden. If a user selects C++, then all content on the site with a class of dotnet or java should be hidden, and so on.

    There needs to a db option set or something so that when the user moves from one page to the next, the user doesn’t have to re-select the setting.

    I am not really sure where to start with this. Any tips or ideas to point me in the right direction?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hakkim

    (@hakkimpahammed)

    Hi Tom,

    Before building an option to filter your contents, you should specify how the contents are currently created and managed in admin side. That is,

    1) Are they posts or pages?
    2) If posts, are they categorized like .NET, C++ etc.
    3) If pages, are they assigned as sub pages of parent pages .NET, C++ etc.
    4) Are you using tags to specify the languages?
    5) Are you using any custom fields to categorize your contents?

    To filter the contents in front end, you must use at least any one of the above methods. That is, .NET, C++ etc should be categories or parent pages or tags. All contents should be correctly assigned to them accordingly. Then we have solutions. Please explain your side.

    Thread Starter TomJohnson

    (@tomjohnson)

    Thanks Hakkim. I appreciate your reply. The content consists of pages. They have some hierarchy, but the hierarchy isn’t based on programming language. It’s more like this:

    Deploying Acme
    – Setting up your Apache server (C++)
    – Setting up your IIS server (.NET)
    – Setting up your Tomcat server (Java)

    And so on. I’m not using nay custom fields to categorize the contents. I didn’t know that was possible. Is there a plugin for that?

    Re categories, parent pages, or tags, I currently don’t have the content set up around this, but I could in the future. Can you provide more detail about the solutions for those setups?

    I basically want it to work like this demo: https://docs.releasenotes.salesforce.com/en-us/summer14/release-notes/rn_included_release_notes.htm

    There’s a drop-down there that allows users to select different versions of the release notes, and then the content filters accordingly.

    Hakkim

    (@hakkimpahammed)

    First of all you should arrange your contents properly in admin side. As you said you have already created contents as pages, you can use tags.

    Categorize pages by tags

    1. Categorize by tags :- This would be easier for you. Just create tags like C++, .NET etc and add them to corresponding pages. If tag option is not available for pages in your site, just do this https://www.sitepoint.com/wordpress-pages-use-tags/
    Once after created the tags and assigned them to contents properly, paste the code from https://www.wplover.com/2112/create-a-dropdown-list-of-tags/ in your template file header or sidebar or footer, that creates a dropdown box of tags, and that will filter your contents accordingly. Try it! Good luck!

    Thread Starter TomJohnson

    (@tomjohnson)

    Thanks Hakkim. This is an interesting approach. I want to actually hide the content not relevant to users. It turns out this tutorial teaches me what I was trying to do:

    https://hibbard.eu/using-cookies-with-jquery-to-make-a-simple-style-switcher/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add options for user to select, which then affect content shown’ is closed to new replies.