В общем проблему я решила и возможно кому то подойдет такой способ решения.
Я создала два php файла taxomomy-business.php и start-page-tax-busines.php.
start-page-tax-busines.php нужен для того что бы вывести список статей которые принадлежат терминам(тегам) таксономии busines.
<?php
/*
Template Name: Business-start-page
*/
$term = get_queried_object();
?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<h2 class="category-name">
Business
</h2>
// выводим список терминов таксономии business
<div class="tag_taxonomy">
<ul>
<li>
<?php wp_tag_cloud(
$args = array (
'largest' => '12',
'smallest' => '12',
'format' => 'flat',
'separator' => "\n",
'orderby' => 'name',
'order' => 'ASC',
'exclude' => null,
'include' => null,
'link' => 'view',
'taxonomy' => 'business',
'echo' => true,
'topic_count_text_callback' => 'default_topic_count_text',
)
);?>
</li>
</ul>
</div>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'paged' => $paged,
'posts_per_page' => 12,
'tax_query' => array(
array(
'taxonomy' => 'business', // слаг таксономии
'field' => 'slug',
'terms' => array( 'app-building', 'banking', 'coaching', 'corporate-messenger', 'e-commerce', 'education', 'healthcare', 'real-time-communication', 'security-compliance', 'social-networking', 'teleconsultation' ) // слаг термина или терминов которые нам нужны
)
),
);
query_posts($args);
?>
<?php if(function_exists('wp_paginate')) { wp_paginate();}?>
//выводим список статей
<?php if ( have_posts() ) :while ( have_posts() ) :the_post();
<!--posts--->
<!-- Post Content-->
<!-- Thumbnail-->
// тут мы выводим термин к которому принадлежит статья из списка
<?php
$cur_terms = get_the_terms( $post->ID, 'business' );
if( is_array( $cur_terms ) ){
foreach( $cur_terms as $cur_term ){
echo '<a href="'. get_term_link( $cur_term->term_id, $cur_term->taxonomy ) .'">'. $cur_term->name .'</a>';
}
}
?>
//заголовок статьи
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile ; ?>
<div class="list-item">
<!--paginate-->
<?php the_posts_pagination(
$args = array(
'show_all' => false,
'end_size' => 0,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => __('Previous'),
'next_text' => __('Next'),
'add_args' => false,
'add_fragment' => '',
'screen_reader_text' => __( 'Posts navigation' ),
'type' => 'list',
)
);
?>
</div>
<?php else : ?>
<?php endif ; ?>
<?php get_footer(); ?>
taxomomy-business.php нужен для того что бы выводить списки статей которые принадлежат тому или иному термину(тегу) кастомной таксономии
<?php
/*
Template Name: Business-Archive
*/
$term = get_queried_object();
?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<h2>
// получаем имя термина(тега)
<?php echo $term->name; ?>
</h2>
<?php
$TaxArhive = array(
'tax_query' => array(
array(
'taxonomy' => 'business', указываем имя таксономии чьи термины мы должны получить
'posts_per_page' => 12,
)
),
);
$queryTaxPost = new WP_Query( $TaxArhive );
?>
<?php if(function_exists('wp_paginate')) { wp_paginate();}?>
<?php if ( have_posts() ) :while ( have_posts() ) :the_post();
<!--posts--->
<!-- Post Content-->
<!-- Thumbnail-->
<div class="cat">
// получаем список терминов к которым принадлежит статья из списка
<?php
$cur_terms = get_the_terms( $post->ID, 'business' );
if( is_array( $cur_terms ) ){
foreach( $cur_terms as $cur_term ){
echo '<a href="'. get_term_link( $cur_term->term_id, $cur_term->taxonomy ) .'">'. $cur_term->name .'</a>';
}
}
?>
//заголовок статьи из списка
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile ; ?>
<?php wp_reset_postdata(); ?>
<div class="list-item">
<!--paginate-->
<?php the_posts_pagination(
$args = array(
'show_all' => false,
'end_size' => 0,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => __('Previous'),
'next_text' => __('Next'),
'add_args' => false,
'add_fragment' => '',
'screen_reader_text' => __( 'Posts navigation' ),
'type' => 'list',
)
);
?>
</div>
<?php else : ?>
<?php endif ; ?>
<?php get_footer(); ?>
Такое решение рабочие, но если у вас много таксономий как у меня то лучше создать единый архивный темплейт.
archive.php
<?php
/*
Template Name: Archive
*/
$term = get_queried_object();
?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
//выводим имя термина
<?php echo $term->name; ?>
<?php
// создаем массив со списком таксономий
$TaxItem = array ('my_tax1', 'my_tax2');
$TaxArhive = array(
'tax_query' => array(
array(
'taxonomy' => $TaxItem,
'posts_per_page' => 12,
)
),
);
$queryTaxPost = new WP_Query( $TaxArhive );
?>
<?php if(function_exists('wp_paginate')) { wp_paginate();}?>
<?php if ( have_posts() ) :while ( have_posts() ) :the_post();
<!--posts--->
<!-- Post Content-->
<!-- Thumbnail-->
<?php
//перебираем список таксономий и выводим список статей с нужным термином
foreach ($TaxItem as $tax) {
switch ($tax) {
case 'my_tax1':
$cur_terms = get_the_terms( $post->ID, $tax );
if( is_array( $cur_terms ) ){
foreach( $cur_terms as $cur_term ){
echo '<a href="'. get_term_link( $cur_term->term_id, $cur_term->taxonomy ) .'">'. $cur_term->name .'</a>';
}
}
break;
case 'my_tax2':
$cur_terms = get_the_terms( $post->ID, $tax );
if( is_array( $cur_terms ) ){
foreach( $cur_terms as $cur_term ){
echo '<a href="'. get_term_link( $cur_term->term_id, $cur_term->taxonomy ) .'">'. $cur_term->name .'</a>';
}
}
break;
}
}
?>
//заголовок статьи
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile ; ?>
<?php wp_reset_postdata(); ?>
<div class="list-item">
<!--paginate-->
<?php the_posts_pagination(
$args = array(
'show_all' => false,
'end_size' => 0,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => __('Previous'),
'next_text' => __('Next'),
'add_args' => false,
'add_fragment' => '',
'screen_reader_text' => __( 'Posts navigation' ),
'type' => 'list',
)
);
?>
</div>
<?php else : ?>
<?php endif ; ?>
<?php get_footer(); ?>
Если Юзер выбрал my_tax1 то он увидет список статей которые принадлежать меткам таксономии my_tax1, если выбрал my_tax2 то увидет список статей которые пренадледат меткам my_tax2