Do you want to show or hide widgets on specific pages in WordPress? You can do this now. In this post we’ll let you know that how to show or hide widgets on specific pages without plugin.

Now you can show or hide widgets on specific pages without using any plugin. This is tiny snippet which is added by Joel Worsham. Firstly you just need to have the ID name of widget which you want to describe. You have two option either it can be done by viewing page source to view the widget id or you can view it using a web inspector tool as well.

The present sample is setup to show essential ‘pages’ widget on the contact page only. Keep in mind that is_page also is also accepted by an array of page names and id’s.

<script src=”https://gist.github.com/maanali/99f419cb3c0a844a28ba.js”></script>

Source