Last active
December 6, 2020 07:37
-
-
Save mihdan/0dfd5644ee5c9fddd39469f72ac01ce9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
## Заполняем опцию 3 | |
function fill_tlap_field_exlude_page() { | |
$val = get_option('tlap_add_analytics_option'); | |
$val = $val ? $val['tlap_excludepage'] : null; | |
?> | |
<span><input size="80" type="text" name="tlap_add_analytics_option[tlap_excludepage]" value="<?php echo esc_attr($val) ?>" placeholder="Введите id страниц через запятую"/>	<span class="pro">PRO</span></span> | |
<div> Страницы, на которых не нужно загружать коды счётчиков статистики (например страницы закрытые от индексации).</div> | |
<div> Ввести ID страниц через запятую без пробела, например: 345,1145,3778 </div> | |
<?php | |
} | |
/** | |
* Подключаем в footer скрпиты счётчиков | |
*/ | |
function tlap_add_analytics_plugin() { | |
$all_options = get_option( 'tlap_add_analytics_option' ); | |
$exclude_page = isset( $all_options['tlap_excludepage'] ) | |
? explode( ',', $all_options['tlap_excludepage'] ) | |
: ''; | |
// Если страниц-исключения - выход. | |
if ( in_array( $postid, $exclude_page ) ) { | |
return; | |
} | |
tlap_add_yametrika(); | |
tlap_add_google_analitics(); | |
} | |
add_action( 'wp_footer', 'tlap_add_analytics_plugin', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment