cheshmak816 4 ارسال شده در آبان 95 گزارش بازنشر ارسال شده در آبان 95 سلام خدمت دوستان کد پست های محبوب من به صورت زیر هستش <aside class="tab-popular"> <div class="tit-tab-pop"><i class="fa fa-heart"></i><h3>محبوب ترین ها</h3></div> <div class="lnks-tab clearfix"> <div class="main-lnks-tab"> <a class="lnk-week" href="#">هفته</a> <a class="lnk-month" href="#">ماه</a> <a class="lnk-year" href="#">سال</a> </div> </div> <div class="main-tab topmusiclist"> <ol class="pop-week"> <?php // the query $arms = array( 'post_type' => 'post', 'posts_per_page' => '10', 'offset' => 0, 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'post_status' => 'publish', 'date_query' => array( array( 'column' => 'post_date_gmt', 'after' => '1 week ago', ), ), ); $the_query = new WP_Query( $arms ); ?> <?php if ( $the_query->have_posts() ) : ?> <!-- pagination here --> <!-- the loop --> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> <!-- end of the loop --> <!-- pagination here --> <?php wp_reset_postdata(); ?> <?php else : ?> <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> <?php endif; ?> </ol> حالا چند تا سوال دارم میخواستم بدونم چطور میتونم فقط از یک کتگوری خاص پست های محبوب رو نشون بدم اخه این کد از تمام پست ها نشون میده بعدش کنار پست های محبوب که نشون میده عدد میزنه،میخوام تصویر شاخص نشون بده که مربوط به هر پست هستش ممنون میشم کمک کنید تصویر مطالب محبوب هم ضمیمه کردم نقل قول لینک به ارسال
amirsenator 21 ارسال شده در آبان 95 گزارش بازنشر ارسال شده در آبان 95 سلام برای نمایش دسته بندی خاص در کوئری پست ها باید از این عبارت استفاده کنی 'cat' => '4' و برای نمایش تصویر شاخاص هم از این قطعه کد باید استفاده کنید <?php if ( has_post_thumbnail()) the_post_thumbnail( array(60,60 ) ); ?> کد رو براتون ویرایش کردم <aside class="tab-popular"> <div class="tit-tab-pop"><i class="fa fa-heart"></i><h3>محبوب ترین ها</h3></div> <div class="lnks-tab clearfix"> <div class="main-lnks-tab"> <a class="lnk-week" href="#">هفته</a> <a class="lnk-month" href="#">ماه</a> <a class="lnk-year" href="#">سال</a> </div> </div> <div class="main-tab topmusiclist"> <ol class="pop-week"> <?php // the query $arms = array( 'post_type' => 'post', 'cat' => '4', 'posts_per_page' => '10', 'offset' => 0, 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'post_status' => 'publish', 'date_query' => array( array( 'column' => 'post_date_gmt', 'after' => '1 week ago', ), ), ); $the_query = new WP_Query( $arms ); ?> <?php if ( $the_query->have_posts() ) : ?> <!-- pagination here --> <!-- the loop --> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li><a href="<?php the_permalink(); ?>"> <?php if ( has_post_thumbnail()) the_post_thumbnail( array(60,60 ) ); ?> <?php the_title(); ?></a></li> <?php endwhile; ?> <!-- end of the loop --> <!-- pagination here --> <?php wp_reset_postdata(); ?> <?php else : ?> <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> <?php endif; ?> </ol> 1 نقل قول لینک به ارسال
cheshmak816 4 ارسال شده در آبان 95 مالک گزارش بازنشر ارسال شده در آبان 95 در ۱ ساعت قبل، amirsenator گفته است : سلام برای نمایش دسته بندی خاص در کوئری پست ها باید از این عبارت استفاده کنی 'cat' => '4' و برای نمایش تصویر شاخاص هم از این قطعه کد باید استفاده کنید <?php if ( has_post_thumbnail()) the_post_thumbnail( array(60,60 ) ); ?> کد رو براتون ویرایش کردم <aside class="tab-popular"> <div class="tit-tab-pop"><i class="fa fa-heart"></i><h3>محبوب ترین ها</h3></div> <div class="lnks-tab clearfix"> <div class="main-lnks-tab"> <a class="lnk-week" href="#">هفته</a> <a class="lnk-month" href="#">ماه</a> <a class="lnk-year" href="#">سال</a> </div> </div> <div class="main-tab topmusiclist"> <ol class="pop-week"> <?php // the query $arms = array( 'post_type' => 'post', 'cat' => '4', 'posts_per_page' => '10', 'offset' => 0, 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'post_status' => 'publish', 'date_query' => array( array( 'column' => 'post_date_gmt', 'after' => '1 week ago', ), ), ); $the_query = new WP_Query( $arms ); ?> <?php if ( $the_query->have_posts() ) : ?> <!-- pagination here --> <!-- the loop --> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li><a href="<?php the_permalink(); ?>"> <?php if ( has_post_thumbnail()) the_post_thumbnail( array(60,60 ) ); ?> <?php the_title(); ?></a></li> <?php endwhile; ?> <!-- end of the loop --> <!-- pagination here --> <?php wp_reset_postdata(); ?> <?php else : ?> <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> <?php endif; ?> </ol> مشکل حل شد تشکر فراوان 1 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .