• Resolved Klecka

    (@klecka)


    My sidebar is called this way in my theme

    <div class="block">
      <?php dynamic_sidebar( 'sidebar-footer-1' ); ?>
    </div>

    When I visit the website, the code shows

    <div class="block">
      <li id="text-4" class="widget widget_text">
        <div class="textwidget">
          ...
        </div>
      </li>
    </div>

    How do I get rid of the markup inside the .block-element?
    In the registration in my functions the args are empty:

    
    'before-widget' => 	'',
    'after-widget' => 	'',
    'class' =>		'',
    
    • This topic was modified 6 years, 5 months ago by Klecka.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s part of the default text widget output. You’d need to extend the widget’s class with a new name and override the appropriate method with your own version that does not produce the undesired output. Then use your version instead of the text widget in your widget area.

    To what end? With appropriate CSS the markup would have no effect.

    Hello @klecka !

    I hope you are doing well today!

    I checked your code and it’s looks like you wrote it in a wrong syntax.

    Please note that:
    'before-widget' & 'after-widget' Must Written with UNDERSCORE (_).
    'before_widget' & 'after_widget'

    This is the default WP Sidebar registration

    <?php $args = array(
    	'name'          => __('Sidebar %d'),
            'id'            => 'sidebar',          
    	'description'   => '',
    	'class'         => '',
    	'before_widget' => '<li id="%1$s" class="widget %2$s">',
    	'after_widget'  => '</li>',
    	'before_title'  => '<h2 class="widgettitle">',
    	'after_title'   => '</h2>' ); 
    ?>

    Best Regards,
    Youssef

    Thread Starter Klecka

    (@klecka)

    Hey @blackcat13007, yah, now I’m doing well. It was that typo. Thank you so much, I thought I was going crazy.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Remove default widget markup’ is closed to new replies.