0

Подскажите, как в виджете заменить тег h3 на тег span? введите сюда описание изображения

т.е. имеется ввиду стандартный виджет, настраиваемый в админке. На сайте в результате "Меню" будет в теге h3. Подскажите, как убрать тег h3 и заменить его на span?

1 ответ 1

1

В файле: wp-content/themes/{имя_шаблона}/functions.php ищите блок кода в котором настраиваются сайдбары. Например, для шаблона twentysixteen это кусок:

function twentysixteen_widgets_init() {
    register_sidebar( array(
        'name'          => __( 'Sidebar', 'twentysixteen' ),
        'id'            => 'sidebar-1',
        'description'   => __( 'Add widgets here to appear in your sidebar.', 'twentysixteen' ),
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ) );

    register_sidebar( array(
        'name'          => __( 'Content Bottom 1', 'twentysixteen' ),
        'id'            => 'sidebar-2',
        'description'   => __( 'Appears at the bottom of the content on posts and pages.', 'twentysixteen' ),
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ) );

    register_sidebar( array(
        'name'          => __( 'Content Bottom 2', 'twentysixteen' ),
        'id'            => 'sidebar-3',
        'description'   => __( 'Appears at the bottom of the content on posts and pages.', 'twentysixteen' ),
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ) );
}
add_action( 'widgets_init', 'twentysixteen_widgets_init' );

Значения before_title и after_title.

1
  • Во первых не "для шаблона" а "для ТЕМЫ". Во вторых данные манипуляции нужно производить в дочерней теме. В третьих не в каждой теме это вообще будет в фанкшине.
    – SeVlad
    16 авг 2017 в 18:46

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.