correct micro newsArcticle
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
<!--[micro/post]-->
|
||||
|
||||
<link itemprop="mainEntityOfPage" href="<?= get_permalink(); ?>"/>
|
||||
|
||||
<meta itemprop="inLanguage" content="ru"/>
|
||||
|
||||
<meta itemprop="headline name" content="<?= htmlspecialchars( get_the_title() ) ?>" />
|
||||
|
||||
<meta itemprop="dateModified" content="<?= the_modified_date("c"); ?>"/>
|
||||
|
||||
<?php // Получаем текущие рубрики поста
|
||||
$categories = get_the_category();
|
||||
if (!empty($categories)) {
|
||||
// Берём первую рубрику (можно изменить логику при необходимости)
|
||||
$current_category = $categories[0]->name;
|
||||
$microcategory = $categories[0]->name;
|
||||
|
||||
} elseif ( in_array( get_post_type(), ["anew", "yellow"] ) && !is_tag() && !is_category() ){
|
||||
$microcategory = 'Новости';
|
||||
}
|
||||
echo '<meta itemprop="articleSection" content="' . $microcategory . '">';
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
get_template_part("template-parts/micro/terms");
|
||||
//get_template_part("template-parts/micro/terms");
|
||||
|
||||
?>
|
||||
|
||||
<!--[/micro/post]-->
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<div class="d-none">
|
||||
|
||||
<?php foreach (wp_get_post_terms( get_the_ID(), ["category", "post_tag"] ) as $term) : ?>
|
||||
<?php foreach (wp_get_post_terms( get_the_ID(), ["category"] ) as $term) : ?>
|
||||
|
||||
<span itemprop="articleSection">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user