Answer the question
In order to leave comments, you need to log in
How to remove the serial number in assigning an ID to a widget?
making my own widget
class bg_widget extends WP_Widget {
// Регистрация виджета, используя основной класс
public function __construct() {
// вызов конструктора выглядит так:
// __construct( $id_base, $name, $widget_options = array(), $control_options = array() )
parent::__construct(
'BookForm',
'BookForm_Widget',
array( // $widget_options
'classname' => 'bookform__block',
'description' => 'Расчет стоимости из даты и количества гостей ',
)
);
}
<section id="bookform-4" class="widget bookform__block"></section>
Answer the question
In order to leave comments, you need to log in
According to the standard, the id must be unique on the page, and WordPress generates it based on the widget id + widget instance number, which is logical, because the widget itself is one, and there can be many instances.
If you need a custom id and/or class for each instance, then try the Widget CSS Classes or Widget Options plugin .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question