I added a new sidebar
function child_register_sidebar(){
register_sidebar(array(
'name' => 'Social Media (Follow)',
'id' => 'sidebar-follow',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'theme-slug' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
}
on my template,
<?php if ( is_active_sidebar( 'sidebar-follow' ) ) { ?>
<div class="follow-container">
<?php dynamic_sidebar( 'sidebar-follow' ); ?>
</div>
<?php } ?>
result:
<div class="follow-container">
<div class="textwidget">
<a href="[full link to your Twitter]">
<img title="Twitter" alt="Twitter" src="https://socialmediawidgets.files.wordpress.com/2014/03/01_twitter1.png" width="35" height="35" />
</a>
</div>
</div>
How can I remove <div class="textwidget">
or change the class name to something else?
Try this code for remove textwidget and apply own class in functions.php
Add
'class' => ''
to your arguments when registering sidebar if you want to remove the class or'class' => 'myClass'
if you want use yours.Registering the widget would look something like this: