I
I
id_baton4eg2018-04-08 11:17:25
WordPress
id_baton4eg, 2018-04-08 11:17:25

How to glue a function call to the footer several times?

This block sticks the generated modal window to the footer of the site, but if I try to add 2 windows, an error immediately flies, how can I loop the sticking to the footer?

echo 'тут выведем ссылку на вспл. окно';

//сгенерируем всплывающее окно и приклеим в футер
add_action('wp_footer', 'footer_modal01'); 
function footer_modal01(){ 
//тут всплывающее окно  html которого должен отправиться в футер
}

In this form, it fires only 1 time, then "can't redeclare function...'

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
E, 2018-04-08
@id_baton4eg

5acc94754564d939613121.png

M
Mr Crabbz, 2018-04-08
@Punkie

Considering your answer to the previous commenter, you can do something like this:

<?php
echo 'тут выведем ссылку на вспл. окно';
//сгенерируем всплывающее окно и приклеим в футер
add_action('wp_footer', 'footer_modal01'); 
if(!function_exists('footer_modal01')):
function footer_modal01(){ 
//тут всплывающее окно  html которого должен отправиться в футер
}
endif;
?>

I
Igor Vorotnev, 2018-04-10
@HeadOnFire

Use one single function, and in the function itself, generate html blocks in a loop. As many as you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question