78 posts
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Has been part of the Envato Community for over 6 years
+2 more
adiacone says

To all the WordPress gurus: as you know, register_sidebar has a property called description since WP 2 .9. I can access that property in the widget code by using the $description variable, but is there a way to reference that variable in my theme?

What I would like to do is be able to show sort of a title for a widget ready area, without using other tricks or additional theme options. However, other ideas are welcomed as well. ;)

Thanks!

3468 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

Off the top of my head (meaning it’s untested), I think you could do something like this in order to show that description only when widgets are not present:

if( !dynamic_sidebar( 'my_sidebar' ) ){
  echo wp_sidebar_description( 'my_sidebar' );
}

(Of course, I think you could also just write whatever you want in place of the description function).

Hope that helps! :)

Chris

78 posts
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Has been part of the Envato Community for over 6 years
+2 more
adiacone says

Hmm… that would be exactly what I would need and makes sense (since there is a wp_widget_description), but I couldn’t find any reference of wp_sidebar_description.

Chris, are you making things up? :P

Adrian

78 posts
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Has been part of the Envato Community for over 6 years
+2 more
adiacone says

My bad, found it! :) Doesn’t work yet, but doing more tests…

LATER EDIT : Yeah, your solution works like a charm, just needed an echo. Thanks! ;)

3468 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

Haha it seems to be missing from the Codex, but I swear I’m not making it up! :P lol

It’s located in widgets.php http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/widgets.php line 674

:)

3468 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

Oh sorry, after closer examination of the function, you have to print the result. I’ve edited my original code to show the correct version :)

3468 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

LATER EDIT : Yeah, your solution works like a charm, just needed an echo. Thanks! ;)

You’re welcome! :)

by
by
by
by
by
by