S
S
smurzak32021-09-04 23:23:44
WordPress
smurzak3, 2021-09-04 23:23:44

How to properly display title in wordpress sidebar?

Faced the problem that the interface of widgets has changed in wordpress. For example, I want to put a title in my sidebar, and I choose the h2 title, but in the code when registering the sidebar, my 'before_title' and 'after_title' are completely different. I want the page to display the title as specified in the code, not in wordpress. How can this be solved other than editing the html code in wordpress itself for each heading?

register_sidebar( array(
    'name'          => 'Right sidebar',
    'id'            => "right-sidebar",
    'description'   => '',
    'class'         => '',
    'before_widget' => '<ul id="%1$s" class="widget contact_info_section %2$s">',
    'after_widget'  => "</ul>\n",
    'before_title'  => '<div class="contact_info_title">',
    'after_title'   => "</div>\n",
    'before_sidebar' => '', // WP 5.6
    'after_sidebar'  => '', // WP 5.6
  ) );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question