Answer the question
In order to leave comments, you need to log in
How to pin a block in Worddress so that it is on all pages?
For example, a footer or menu is always on the pages and when you create a new one, it also appears
Answer the question
In order to leave comments, you need to log in
Add the code to the functions.php
file in the active theme folder (you can add the code to the end of the file, but before the closing tag: ?> - if it is there, and if it is not there, then just to the end of the file):
register_sidebar(array(
'name' => 'Мой блок',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<div class="title">',
'after_title' => '</div>',
));
as others said, everything is correct, you need to know at least html
and then there are 2 questions.
if the block is the same and static content, then this is done quickly and easily.
we hang this block on the footer or header hook in function.php
, this is a more difficult solution, since the header.php or footer.php file, depending on the theme, may be different for the pages. but get_header or its equivalent for the footer will be the same in 98%.
dd_action( 'get_header', 'action_function_name_1277' );
function action_function_name_1277( $name ){
тут пишем то что хотим вывести но если юзаем тупо html то не забыть закрыть php и потом открыть его заново
или через echo "";
}
Add this "block" to the appropriate template (footer.php, header.php, page.php)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question