Created
February 10, 2018 21:08
-
-
Save morozVA/8dc496dd363cdd59baef3db6533b6420 to your computer and use it in GitHub Desktop.
wp солянка
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 bloginfo('template_url') ?>/images/ ссылка на папку images в шаблоне | |
/********************************************/ | |
<?php echo home_url(); ?> Ссылка на главную | |
<?php echo do_shortcode( '[ваш шорткод]' ); ?> Шорткод в шаблоне | |
/********************************************/ | |
<a href="#contact_form_pop" class="fancybox fancybox-inline">Перезвоните мне</a> | |
<div style="display:none" class="fancybox-hidden"> | |
<div id="contact_form_pop"> | |
<?php echo do_shortcode('[contact-form-7 id="4" title="Заказ звонка"]'); ?> | |
</div> | |
</div> | |
/******************Проверка на какой странице***********************/ | |
if( is_home() ){ | |
// код | |
} | |
<?php if (is_page('71')) { ?> | |
//код | |
<?php } ?> | |
/***************************************************/ | |
Вывод контента определенной страницы | |
<?php | |
// Число 123 замените на идентификатор вашей страницы, которую хотите загрузить: | |
$page_id = 2; | |
// Вы должны присвоить идентификатор переменной, иначе WordPress будет генерировать ошибку: | |
$page_data = get_page( $page_id ); | |
// Показываем заголовок страницы: | |
print '<h3>'. $page_data->post_title .'</h3>'; | |
// Выводим содержимое страницы, сохраняя стандартные фильтры WordPress: | |
print apply_filters('the_content', $page_data->post_content); | |
?> | |
/********************************************/ | |
Плагин Advanced custom fields | |
<a class="colorbox" rel="group" href="<?php the_field('миниатюра'); ?>"> | |
<img class="img-link-initial" src="<?php the_field('большое_изображение'); ?>" alt="" /> | |
</a> | |
<?php if ( get_field('картинка_1') ) {?> | |
<a rel="group" href="<?php the_field('картинка_1'); ?>"> | |
<img class="img-link-initial" src="<?php the_field('картинка_1'); ?>" alt="" /> | |
</a> | |
<?php } ?> | |
Просто произвольные поля <?php the_meta(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment