I would like to load posts based on which categories are selected. The load should be done without refreshing the page. My first thought was to include AJAX in a wordpress function, but I want to know if there's already something premade for that? Or some skeleton at least.

enter image description here

These are my categories, so when selecting one (or more) category posts should load.

  • You have to implement this yourself. Have you search ? There is a lot of good tutorial on Internet
    – Laxmana
    Apr 27 '17 at 7:07
  • Possible duplicate of Using ajax on categories and wordpress loops
    – Laxmana
    Apr 27 '17 at 7:07
  • A plugin would be a good option. We use FacetWP for ajax filtering. Check out the demo, you can filter by categories, tags, custom fields, etc. facetwp.com/demo/cars . It's a premium plugin but well worth it.
    – Joe Dooley
    Apr 27 '17 at 7:13

No there is no such premade code to load posts based on which categories are selected without reload the page content. There are two option you can imply.

Option 1: Using Ajax
Option 2: Loading all the content and hide/show using CSS & jQuery tricks

Note: Option 2 increase your initial load time as you need to fetch all the content from all the category and show some post initially with CSS tricks. And on click of the specific category you can then with help of jQuery & CSS you can manipulate the display.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.