Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From your question it sounds like you might have widgets and sidebars slightly confused -- or maybe it just sounds that way from the way you're using the two terms. So my apologies if I'm restating the obvious to you.</p> <p><strong>Sidebars</strong> are dynamic sections on your site that can display widgets. <em>Widgets</em> are the individual items that are displayed in one or more sidebars. The function you're referencing, <strong>register_sidebar()</strong>, is meant for creating a sidebar area -- one of those blocks in the Settings --> Appearance menu that you can drag widgets to. The description field is meant just to indicate basic info. about where that particular sidebar is used. For example, if you register a sidebar that you plan to use in your header the description might be something like "Appears in header above navigation menu." </p> <p>Widgets also have descriptions that give info. on how to fill out their various options. That sounds like what you're trying to do. So the question would be what widget are you trying to use? It's in the widget code that you would set up that description you're talking about.</p> <p>As far as sidebar descriptions, Wordpress uses the function <strong>wp_sidebar_description($id)</strong> to output the description for each sidebar. That function runs the description text through another Wordpress function, <strong>esc_html()</strong>, which runs it through a couple of checks and removes anything that might be a problem.</p> <p>There is an opportunity for you to change the default output though. The last thing it does is apply a filter, <strong>esc_html</strong>, to the text. So if you want to make <code>&lt;br&gt;</code> actually function as a newline, you could simply add a filter in your theme's functions.php file to restore that functionality, like so:</p> <pre><code>add_filter('esc_html', 'newLines'); function newLines($desc){ return htmlspecialchars_decode($desc); } </code></pre> <p>That will basically undo what Wordpress is doing and output any HTML code (bold, italics, etc.) just as you'd expect. </p> <p>Should have noted in the original response, the above filter will affect the esc_html() function <strong>everywhere it is used on your site</strong> -- you probably do not want that! </p> <p>There aren't, unfortunately, any hooks or filters that would let you target a specific sidebar but you could limit the filter above to only happening on the admin page by using the following:</p> <pre><code>function newLines($desc){ global $pagenow; global $wp_registered_sidebars; if($pagenow == 'widgets.php'){ return htmlspecialchars_decode($desc); } } add_filter('esc_html', 'newLines'); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload