<?php
$categories = get_the_category($post->ID);
foreach($categories as $category) :
$children = get_categories( array ('parent' => $category->term_id ));
$has_children = count($children);
if ( $has_children == 0 ) {
echo $category->cat_name;
}
endforeach;
?>
<?php $category = get_the_category();
if ($category) {
echo '<a class="txt txt_gray txt_small newsfeed__paramlink ' . $category[0]->category_nicename.'" href="' . get_category_link( $category[0]->term_id ) . '" title="' . sprintf( __( "%s", "elitenews" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> ';
}
?>
/**
* Display Contact Form 7 messages in a popup.
*/
function ContactForm7_popup() {
$return = <<<EOT
<script>
jQuery(".wpcf7-form input[type='submit'], .wpcf7-form button").click(function(event) {
jQuery( document ).one( "ajaxComplete", function(event, xhr, settings) {
var data = xhr.responseText;
var jsonResponse = JSON.parse(data);
// console.log(jsonResponse);
if(! jsonResponse.hasOwnProperty('into') || $('.wpcf7' + jsonResponse.into).length === 0) return;
// alert(jsonResponse.message);
$.fancybox.open(
'<div class="message"><div class="result popup__result"><div class="result__succes result__item"><div class="result__wrapper"><div class="result__title"><div class="title title_big"><span>Успех!</span></div><div class="title title_small"><span>Ваша заявка успешно отправлена! </span><br><span>Я свяжусь с вами в ближайшее время.</span></div></div><div class="result__controls"><div data-fancybox-close class="btn btn_bg_pink"><span>Вернуться на сайт</span></div></div></div></div></div></div>',
{
smallBtn : true,
toolbar : false
}
);
});
});
</script>
<style>
div.wpcf7-response-output, div.wpcf7-validation-errors { display: none !important; }
span.wpcf7-not-valid-tip { display: none; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: #ff2c00; // background-color: rgba(153,0,0,0.3); }
</style>
EOT;
echo $return;
}
add_action( 'wp_footer', 'ContactForm7_popup', 20 );
<!-- Карточки Начало цикла-->
<?php $penis = get_the_ID(); ?>
<?php
$sort = $_COOKIE["catalog_sort"];
$show_count = (int)$_COOKIE["catalog_show_count"];
$sort = str_replace('\\', "", $sort);
$sort = json_decode($sort, true);
if(!$show_count)
$show_count = 24;
$queryArr = array(
'post_type' => 'page',
'post_parent' => $penis,
'meta_query' => array(
"template" => array(
"key" => "_wp_page_template",
"value" => "templates/catalogue_detail.php",
"type" => 'NUMERIC'
),
),
'paged' => $currPage,
'posts_per_page' => $show_count,
'order' => strtoupper($sort["type"]),
);
if($sort)
{
switch ($sort["by"]) {
case 'alphabet':
$queryArr["orderby"] = "title";
break;
case 'price':
$queryArr["meta_key"] = "item_price";
$queryArr["orderby"] = "meta_value_num";
break;
}
}
$query = new WP_Query( $queryArr );
while ($query->have_posts()) : $query->the_post();?>
<?php $aidi = get_the_ID(); ?>
<section class="section timetable">
<div class="section__top section__top_page contacts__top" style="background-image: url('<?php the_field( "картинкарррррррррр" );?>')">
<div class="section__content"></div>
<svg class="section__triangle" viewbox="0 0 1000 105" preserveaspectration="none">
<polygon class="section__polygon" points="0,10 0,105 800,105 800,120"></polygon>
<polygon class="section__polygon" points="1000,0 1000,105 500,105 500,85"></polygon>
</svg>
</div>
<div class="section__bottom graphics__bottom graphics__bottom_padding">
<div class="section__wrapper courses__bg">
<div class="section__content section__content_min">
<div class="courses__wrap">
<h1 class="section__img-desc section__img-desc_black"><?php the_title()?></h1>
</div>
</div>
</div>
<div class="section__content">
<ul class="section__list courses__display">
<li class="section__item courses__item courses__item_one">
<div class="section__item-wrap graphics__item">
<div class="section__img">
<div class="section__img-pic" style="background-image: url('<?php the_post_thumbnail_url() ?>')"></div>
<div class="section__img-desc courses__img-desc"><?php the_title()?></div>
</div>
<div class="section__desc">
<div class="courses__desc-wrap">
<div class="courses__text section__text"><?php the_content(); ?></div>
<div class="courses__num-lesson courses__title-num_darken"><?php the_field( "urokiaaa" );?></div>
</div>
<div class="section__controls"><a class="courses__btn section__btn section__btn_darken" href="<?php the_permalink(); ?>">подробнее</a></div>
</div>
</div>
</li>
</ul>
</div> </div>
</section>
<?php
endwhile;
wp_reset_query();
?>
<!-- Конец цикла -->
<!-- Карточки -->
<div class="row catalogue_main__cards">
<?php $penis = get_the_ID(); ?>
<?php
$sort = $_COOKIE["catalog_sort"];
$show_count = (int)$_COOKIE["catalog_show_count"];
$sort = str_replace('\\', "", $sort);
$sort = json_decode($sort, true);
if(!$show_count)
$show_count = 24;
$queryArr = array(
'post_type' => 'page',
'post_parent' => $penis,
'meta_query' => array(
"template" => array(
"key" => "_wp_page_template",
"value" => "templates/catalogue_detail.php",
"type" => 'NUMERIC'
),
),
'paged' => $currPage,
'posts_per_page' => $show_count,
'order' => strtoupper($sort["type"]),
);
if($sort)
{
switch ($sort["by"]) {
case 'alphabet':
$queryArr["orderby"] = "title";
break;
case 'price':
$queryArr["meta_key"] = "item_price";
$queryArr["orderby"] = "meta_value_num";
break;
}
}
$query = new WP_Query( $queryArr );
while ($query->have_posts()) : $query->the_post();?>
<?php $aidi = get_the_ID(); ?>
<!-- Вывод -->
<div class="col-lg-4 col-md-4 col-6">
<a href="<?php the_permalink(); ?>" class="events_items_slider__block" tabindex="0">
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'full-size', true);
?>
<div class="event_card__pic contain" style="background-image: url(<?php echo $thumb_url[0];?>);"></div>
<p class="events_items_slider__block__title"><?php the_title();?></p>
<p class="events_items_slider__block__price"><?php the_field('item_price'); ?> ₽</p>
</a>
</div>
<!-- Конец цикла -->
<?php
endwhile;
wp_reset_query();
?>
'menu' => 'Primary',
, в wp_nav_menu( $args )
нужно поменять значение на 'menu' => 'menu-1',
.<?php
$args = array(
'theme_location' => 'Primary',
'menu' => 'menu-1',
'container' => 'ul',
'container_class' => '',
'container_id' => '',
'menu_class' => '',
'menu_id' => 'nav4',
'echo' => 'false',
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => '',
);
wp_nav_menu( $args );?>
<?php print str_replace("<a ","<li><a " ,strip_tags( wp_nav_menu(array(
'theme_location' => 'Primary',
'menu' => 'Primary',
'container' => false, // - без предварительно обертки тегом.
'echo' => false, // - вернуть меню для предварительной обработки средствами PHP.
'items_wrap' => '%3$s', // - аргумент функции формата строки sprintf().
'depth' => 0, // - глубина, уровень вложенности = 0.
)
), '<a>'));
?>