Conditional Dropdown - Categories Posts

Hi, I’m looking for a way to display some post cards (Source Theme), depending on if the user selected a certain category in a dropdown menu (sidebar) like the one in the image below.

Please, ignore the placeholder text of post cards hah.

Two main ways to do this:

  1. Mark each postcard with classes corresponding to its tags (do this by editing the theme, if your theme doesn’t already do this - many do). When a category is selected, use javascript (or even css wizardry) to make that class visible (display: block) and make other classes hidden (display: none). This is going to require you to get more posts onto the page than would be typical, since most of them will be hidden.
  2. When the user chooses a category, use the content API to get some posts that match that tag (or make a request to the tag page for that tag and extract what you want). Use javascript to insert that content onto the page, replacing what’s there to start.

Option 1 makes one big database request on the first page load and then will be super fast, but likely makes the most sense for a small number of categories, so that if you get the top 50 posts, you’re likely to get enough to display for any given category.

Option 2 makes the most sense if you have a ton of different tags, and don’t want to load a bunch of unrequested content. However it’ll feel a little slower, since you’re going to have to ask the server for the content when the user chooses a category, instead of having it all loaded but hidden.

If all of that sounds like way more coding than you had in mind, I think @brightthemes 's Rinne theme has some category-ish behavior: Rinne — Resources & Directory Ghost Theme | Bright Themes