I am have a theme by the "blog" post type and I use the code below to add term category to this post type
$labels = array(
'name' => 'دستهها',
'singular_name' => 'دستهها',
'search_items' => 'جستجوی دسته',
'popular_items' => 'بیشتر استفاده شده',
'all_items' => 'تمام دستهها',
'parent_item' => 'مادر دسته',
'edit_item' => 'ویرایش دسته',
'update_item' => 'بروزرسانی دسته',
'add_new_item' => 'افزودن دسته جدید',
'new_item_name' => 'دسته جدید',
'separate_items_with_commas' => 'جداسازی دستهها با کاما',
'add_or_remove_items' => 'افزودن یا حذف دسته',
'choose_from_most_used' => 'انتخاب از محبوبها'
);
$args = array(
'label' => 'دسته',
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => array( 'slug' => 'term', 'with_front' => true ),
'query_var' => true
);
register_taxonomy( 'term', 'blog', $args );
I don't know what query can see the posts and I need to know how to add pagination to this file.
My taxonomy-term.php:
<?php get_header(''); ?>
<section id="description">
<div class="container">
<hgroup>
<h1>وبلاگ روکش</h1>
<h2>
<P> آخرین اخبار و رویداد های روکش را در وبلاگ روکش دنبال کنید و از تکنولوژی ها و آموزش های روکش در حهت افزایش آگاهی و مهارت های خود در زمینه طراحی وب استفاده کنید. </P>
</h3>
</hgroup>
</div>
</section>
<?php if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb('<div class="breadcrumbs"><div class="container">','</div></div>');
} ?>
<div id="blog">
<div class="container">
<section id="main-blog">
<div class="post-items">
<?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query();
if(!empty($wp->query_vars['term'])){ $terms = $wp->query_vars['term']; $taxonomy = 'term'; }
if(!empty($wp->query_vars['library-tags'])){ $terms = $wp->query_vars['library-tags']; $taxonomy = 'library-tags'; }
$paged = ($wp->query_vars['page']) ? $wp->query_vars['page'] : 1;
$args = array(
'post_type' => 'blog',
'paged' => $paged,
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $terms
)
)
);
$wp_query->query( $args ); ?>
<?php if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="news" id="<?php the_ID();?>">
<header>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<figure>
<img alt="<?php the_title(); ?>" title="<?php the_title(); ?>" src="" />
</figure>
</a>
<span class="cat">
<?php echo get_the_term_list( $post->ID, 'term', ' ', '' ); ?>
</span>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="detail">
<span class="author">
<i class="icon-user"></i>
<?php the_author_posts_link();?>
</span>
<span class="date">
<i class="icon-calendar-empty"></i>
<?php the_date('d F y') ;?>
</span>
<div class="clear"></div>
</div>
</header>
<article>
<?php the_content("ادامه مطلب ..."); ?>
</article>
</div>
<?PHP endwhile; endif; ?>
<?php paginate(); ?>
<?php $wp_query = null; $wp_query = $temp;?>
</section>
<aside id="sidbar-blog">
<div>
<h3>خبرنامه روکش</h3>
<form>
<input type="text" placeholder="ایمیل خود را وارد کنید"/>
<input type="submit" value="ثبت"/>
</form>
<div class="clear"></div>
</div>
<nav>
<h3>دسته بندی ها</h3>
<?php
$args = array('container' => false, 'theme_location' => 'blog');
wp_nav_menu($args);
?><div class="clear"></div>
</nav>
</aside>
<div class="clear"></div>
</div>
</div>
<?php get_footer(); ?>
<?php wp_footer(); ?>