Adding expend/collapse effect in WP Categories Widget

Categories Expend/Collapse Effect

This functionality will be very useful for those users who have long parent-sub category list on his/her site. WordPress have default Categories widget. I am adding the toggle effect there and hiding the all sub categories. Clicking on the “+” icon respective sub categories will expend. Just following the bottom steps and achieve this functionality.

Assuming that you already added the “Categories” widget at your sidebar.

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

EU users will subscribe the plan from here Subscribe Now

Step 2:

We need to enqueue this js file for front end only. Open the functions.php file and add the following the PHP script there:

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

EU users will subscribe the plan from here Subscribe Now

Step 3:

This is the last step. Doing some fancy design for professional look. You will change this CSS codes as per your site design. Here is my CSS (style.css file):

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

EU users will subscribe the plan from here Subscribe Now

If you need any help then you can feel free ask me.

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 *