Filtering the posts by categories without page refresh

For this functionality I implemented the shortcode. So you can add it in your page/post or widgetized page. Click here to see the live preview of this functionality. Checkout the step-by-step instruction at below:

Step 1

Initializing the [filter_by_category] shortcode by “init” hook. This hook is calling after WordPress has finished loading but before any headers are sent. [filter_by_category] shortcode have four parameters: ids, onload, limit and show_pagination. These parameters are explained in PHP scripts. You will add the following code in your functions.php file.

This content is only available to members. You must subscribe the monthly membership plan ($.9.99 USD).

Step 7

Showing the some examples of [filter_by_category] shortcode. So you can easily use it on your site (post/page or widget area).

  1. Without pagination: [filter_by_category ids=’23,45,26′ limit=’5′]
  2. With pagination: [filter_by_category ids=’23,45,26′ onload=’45’ limit=’3′ show_pagination=’yes’].
    • ids: these are categories id.
    • limit: Showing 3 posts per page
    • onload: When page is loading for first time, then posts will load from this category. If you do not use it, posts will load from first category ID (here it will be 23)
    • show_pagination: if you set “yes” then “load more” button will appear and Ajax based pagination will work. Default is “no”.

If you need help, feel free to contact me via the contact page.

Share This Article

Subscribe Membership Plan ($9.99/mo)

  • Get full access to all premium tutorials
  • Get Support for the posted content
  • Request for specific how-to tutorials
  • Cancel the subscription at anytime

Reader Interactions

Leave A Reply

Your email address will not be published. Required fields are marked *