WordPress 3.05 - How to check if a sidebar has widgets?

Posted on 2011-02-28
Last Modified: 2012-05-11
How do we check if a sidebar has widgets? I just want to check without calling it.
In general the following is used to check and call:
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar(2)) :

Open in new window

My requirement is just to check and not call.

Please guide.
Question by:rajoo_sharma
  • 2
  • 2
LVL 14

Accepted Solution

R-Byter earned 500 total points
ID: 34999405
Look at this topic on Wordpress forum:


P.S. I saw you posted same question on wordpress forums. :)

Author Comment

ID: 35004473
Thanks for the reply :)
I did post on WP forum as well.
In fact on WP forum too, I got the reply.
is_sidebar_active function is the answer.
Thanks again.

Author Closing Comment

ID: 35004477
Thanks for the solution.
LVL 14

Expert Comment

ID: 35004912
You're welcome and thanks for the points.


Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question