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 | |
$sesons_images= get_field('group1','option'); //option это не обязательный параметр, он показывает что настройка находяится в отдельном элементе меню | |
if( $sesons_images ): | |
foreach($sesons_images as $element): | |
?> | |
<li> | |
<?php if( $element ): ?> | |
<a href="<?php echo $element['element_group1']; ?>"> | |
<img src="<?php echo $element['element_group1']['url']; ?>" alt="season"> |
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 //Главным образом необходимо вставить в файл functions.php вашей темы | |
if( function_exists('acf_add_options_page') ) { | |
//создаем новый элемент меню | |
acf_add_options_page(array( | |
'page_title' => 'Theme General Settings', | |
'menu_title' => 'Theme Settings', | |
'menu_slug' => 'theme-general-settings', | |
'capability' => 'edit_posts', | |
'redirect' => false | |
)); |
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 $support_us = get_field('group1','option'); //Получаем элементы первой группы | |
if( $support_us ): ?> | |
<div class="col-md-4"> | |
<h4 class="tittleBlock"><?php echo $support_us['element_group1'];//Стандартный пример вывода полей из группц ?></h4> | |
<a href="<?php echo $support_us['element_group1']; ?>"> | |
<img src="<?php echo esc_url( $support_us['group2']['element_group2']['url'] ); | |
// Сначала получаем имя вложеной группы (support_us_elements). После чего мы можем спокойно обращаться к | |
// Элементам уже вложенным во вторую группу, в нашем случае этом поле (support_us_image_preview). URL-это только для картинок ?>" alt="fest"> | |
</a> | |
</div> |
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 | |
//Проверка и отображение имен и файла | |
if(!empty($_FILES["upload_file"]["tmp_name"])){ | |
$overrides = ['test_form' => false]; | |
$result = wp_handle_upload( | |
$_FILES['upload_file'], | |
$overrides | |
); | |
$url_file_path=$result['url']; |
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 | |
// Картинки из стандартной галереи товара | |
$meta = explode(',',get_post_meta( $post->ID,'_product_image_gallery')[0]); | |
// Добавляем главную картинку товара (Для вывода ее в галерее товара) | |
$product_galegy[] = array( | |
'thumb' =>wp_get_attachment_image_src(get_post_meta( $post->ID,'_thumbnail_id')[0],'slide_product_thumb')[0], | |
'full' => wp_get_attachment_image_src(get_post_meta( $post->ID,'_thumbnail_id')[0],'slide_product_full')[0], | |
'type'=> 'photo', | |
'url'=> '' |
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 //Получение категорий | |
$prod_cat_args = array( | |
'taxonomy' => 'product_cat', | |
'orderby' => 'id', // здесь по какому полю сортировать | |
'hide_empty' => false, // скрывать категории без товаров или нет | |
'parent' => 0 // id родительской категории | |
); | |
?> | |
<ul> | |
<?php //Получение всего списка категорий |
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
<ul> | |
<?php do_action("woocommerce_pagination"); ?> | |
</ul> |
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 | |
$comments = get_comments(); | |
$data = [ | |
'comment_post_ID' => 1, | |
'comment_author' => 'admin', | |
'comment_author_email' => 'admin@admin.com', | |
'comment_author_url' => 'http://', | |
'comment_content' => 'content here', | |
'comment_type' => 'comment', |
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 | |
$comments = get_comments(array( | |
'status' => 'approve', // комментарии прошедшие модерацию | |
)); | |
// Формируем вывод списка полученных комментариев | |
wp_list_comments(array( | |
'per_page' => 1, // Пагинация комментариев - по 8 на страницу | |
'reverse_top_level' => false // Показываем последние комментарии в начале | |
), $comments); |