78 posts
  • Has been a member for 6-7 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Romania
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
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!

3418 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer 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 been a member for 6-7 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Romania
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
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 been a member for 6-7 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Romania
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
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! ;)

3418 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer 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

:)

3418 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer 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 :)

3418 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer 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