1. hassan
  2. برنامه‌نویسی و طراحی وب
  3. دوشنبه, 05 مهر 1395
سلام و خسته نباشید
بنده در وردپرس یک پست تایپ ساختم با دسته بندی پیش فرض خود وردپرس
کد پست تایپ:

// Add new post type for Photos
add_action('init', 'logo_photos_init');
function logo_Photos_init()
{
$photo_labels = array(
'name' => _x('لوگوها', 'post type general name'),
'singular_name' => _x('لوگو', 'post type singular name'),
'all_items' => __('همه لوگوها'),
'add_new' => _x('اضافه کردن لوگو', 'لوگوها'),
'add_new_item' => __('اضافه کردن لوگو'),
'edit_item' => __('ویرایش لوگو'),
'new_item' => __('لوگو جدید'),
'view_item' => __('مشاهده لوگو'),
'search_items' => __('جستجو در لوگوها'),
'not_found' => __('هیچ لوگویی پیدا نشد'),
'not_found_in_trash' => __('هیچ لوگویی در سطل زباله یافت نشد'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $photo_labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'taxonomies' => array( 'category', 'post_tag' ),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 5,
'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields'),
'has_archive' => 'archive-name'
);
register_post_type('logos',$args);
}


کد حلقه مطلب در صفحه ایندکس:

<?php query_posts("showpost=1&post_type=logos");while( have_posts() ) : the_post(); ?>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<article class="logo-article">
<a href="/<?php the_permalink() ?>"><?php the_post_thumbnail( array( 300, 300) ); ?></a>
<h2 class="logo-h2"><a href="/<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
</article>
</div>
<?php endwhile;?>
<?php wp_reset_query();?>


اما نمی دونم چرا درست نشون نمیده و بهش عدد میدم تعداد مطالب رو فیلتر نمیکنه؟


هنوز پاسخی به این پست ارسال نشده است.
البته از آنجایی که هنوز در سایت لاگین نکرده‌اید، اجازه‌ی پاسخ دادن به این پست را ندارید.