I’d like to pull in a dynamic sidebar. I have 1 text item in the widget sidebar but I DON’t want to pull in widget the title (just the body). Can anyone show me where WordPress is pulling in the Title?
e.g. At the moment I have…
// In my page template...
<div id='advert-header'>
<?php dynamic_sidebar( 'Header Advert' ); ?>
</div>
// In functions.php...
function twentyten_widgets_init() {
register_sidebar( array(
'name' => __( 'Header Advert', 'twentyten' ),
'id' => 'primary-widget-area',
'description' => __( 'The primary widget area', 'twentyten' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
// etc.
}
Widget always have a filter applied on title name ‘widget_title’, use that.
Thanks
-Shak
You can try this (in
functions.php
withinregister_sidebar
)And Css
You can also try this.
Those titles can be useful for CMS user, so in your
register_sidebar
, you can put sth. like I did in code below (works in WordPress 5.0.3). Now widgets title is in html comment, it seems ok for meOr you can make it even more simple by doing this in functions:
Is there a title field for the widget you are using?
You could try just putting
in there, so you get a space for the title.Not the most elegant solution though.
couldn’t you just do
display: none;
in the css for widget-title?Please put this code in functions.php file.