我设法添加了一个显示类别的下拉列表。我希望这些类别显示与分配的标签相关的产品,但我无法让分页与类别和标签一起使用。分页不经常出现。请帮我提供代码。
<div class="category-dropdown">
<form id="tool-category-select" class="tool-category-select" method="get">
<?php
// Create and display the dropdown menu.
wp_dropdown_categories(
array(
'orderby' => 'NAME', // Order the items in the dropdown menu by their name.
'taxonomy' => 'category', // Only include posts with the taxonomy of 'category'.
'name' => 'category', // Change this to the
'show_option_all' => 'All category', // Text the dropdown will display when none of the options have been selected.
'selected' => km_get_selected_taxonomy_dropdown_term(), // Set which option in the dropdown menu is the currently selected one.
'tag' => 'maxxio',
) );
?>
<input type="submit" value="View" />
</form>
</div>
<?php $category_in_taxonomy_term = km_get_category_in_taxonomy_term(); ?>
<!-- If posts were found, -->
<?php if ( $category_in_taxonomy_term->have_posts() ) : ?>
<!-- Loop through every post. -->
<?php while ( $category_in_taxonomy_term->have_posts() ) : $category_in_taxonomy_term->the_post(); ?>
<!-- Display each post's title and content - you can change this section to display whatever post content you want. -->
<div class="prod_item">
<a href="<?php the_permalink(); ?>">
<span class="title"><?php the_title(); ?></span>
<?php the_post_thumbnail( 'prod_thumb' ); ?>
<span class="know_more">KNOW MORE <i class="fa fa-angle-right"></i></span>
</a>
</div>
<?php endwhile;
?>
<?php
if (function_exists("pagination")) {
pagination($custom_query->max_num_pages);
}
wp_reset_postdata(); ?>
<?php endif; ?>