A1i 0 ارسال شده در تیر 94 گزارش بازنشر ارسال شده در تیر 94 با سلام،در کدی که قرار داده شده، مطالب مرتبط بر اساس دسته بندی مرتب می شود، من قصد دارم که مطالب بر اساس تگ (برچسب) نمایش داده شوند. البته کد دیگری رو امتحان کردم و مطالب بر اساس تگ مرتب شدند، اما مشکل اینجاست که اندازه تصاویر شاخص به اندازه مطالب اصلی نمایش داده میشه و باعث به هم ریختن قالب می شود.لطفا راهنمایی کنید. <?php$i=1;$categories = get_the_category($post->ID);if ($categories) {$subcategory_ids = array();foreach ($categories as $individual_category) {if($individual_category->category_parent != 0){//$cs2 = get_categories("orderby=name&hide_empty=0&child_of=" . $individual_category->term_id);//foreach ($cs2 as $cs3) {$subcategory_ids[] = $individual_category->term_id;//echo ($cs3->term_id . ",");//}}}if(empty($subcategory_ids)){foreach ($categories as $individual_category) {$subcategory_ids[] = $individual_category->term_id;//echo $cs4->name;}}//foreach ($subcategory_ids as $cs) {// echo ($cs . ";");//}$args = array('category__in' => $subcategory_ids,'orderby' => 'rand',//'post__not_in' => array($post->ID),'showposts' => 8, // Number of related posts that will be shown.'caller_get_posts' => 1);wp_reset_query();query_posts($args);if (have_posts()) {while (have_posts()) {the_post();?><div class="related"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><div class="des"><?php $name1 = get_post_meta($post->ID, 'name1', true); if ($name1) { ?><p><?php echo $name1; ?></p><p><?php $post_meta = get_post_meta($post->ID, 'name2',true); if (!empty($post_meta)) { ?><?php echo $post_meta; ?><?php } ?></p><?php } else { ?><p><?php the_title(); ?></p><?php } ?></div><?php if(get_post_meta($post->ID,'select',true) == 'music') { ?><div class="moz">Music</div><?php } ?><?php if(get_post_meta($post->ID,'select',true) == 'album') { ?><div class="moz">Album</div><?php } ?><?php if(get_post_meta($post->ID,'select',true) == 'musicvideo') { ?><div class="moz">Video</div><?php } ?><div class="cover"><?php if( has_post_thumbnail() ) { ?><img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=125&w=125&zc=1" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" width="125" height="125"><?php } else { ?><img src="<?php bloginfo('template_url'); ?>/images/no-thumbnail.png" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" width="125" height="125"><?php } ?></div></a></div><?php $i++; } } } wp_reset_query();?> نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .