add files
This commit is contained in:
70
template-parts/header/category-name.php
Normal file
70
template-parts/header/category-name.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<!--[header/category-name]-->
|
||||
|
||||
<?php if ( is_search() ) : ?>
|
||||
|
||||
<a href="/?s=">
|
||||
|
||||
Поиск
|
||||
|
||||
</a>
|
||||
|
||||
<?php elseif ( is_events() ) : ?>
|
||||
|
||||
<a href="/events">
|
||||
|
||||
События
|
||||
|
||||
</a>
|
||||
|
||||
<?php elseif ( in_array( get_post_type(), ["anew", "yellow"] ) && !is_tag() && !is_category() ) : ?>
|
||||
|
||||
<a href="/news">
|
||||
|
||||
Новости
|
||||
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if( is_tag() ) : ?>
|
||||
|
||||
<a href="<?= get_term_link( get_queried_object() ) ?>">
|
||||
|
||||
<?= get_term( get_queried_object_id() )->name ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if ( get_post_type() == "archive" ): ?>
|
||||
|
||||
<span>
|
||||
|
||||
Архив
|
||||
|
||||
</span>
|
||||
|
||||
<?php elseif( !is_events() && ( is_single() || is_category() ) ) : ?>
|
||||
|
||||
<?php
|
||||
|
||||
$term_id = get_current_page_main_taxonomy_term_id( );
|
||||
|
||||
$color = get_term_meta( $term_id, "color", true );
|
||||
|
||||
$color = $color ? $color : "grey";
|
||||
|
||||
?>
|
||||
|
||||
<?php if( $term_id ): ?>
|
||||
|
||||
<a href="<?= get_term_link( $term_id ) ?>">
|
||||
|
||||
<?= get_term( $term_id )->name ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!--[/header/category-name]-->
|
||||
Reference in New Issue
Block a user