วิธีแก้ Thumbnail Relate post ไม่ขึ้น โดย Cymiz
<div id="featured-category">
<?php $featured_category = get_theme_option('featured_category_id1'); $featured_number = get_theme_option('featured_number1'); ?>
<?php if(($featured_category == 'Choose a category:') || ($featured_number == 'Number of post:')) { ?>
<?php { /* nothing */ } ?>
<?php } else { ?>
<div class="featured-cat-entry">
<h3> <?php $cat_id = get_cat_id($featured_category); $category = get_cat_name($cat_id); echo $category; ?></h3>
<?php
$category_id = get_cat_id($featured_category);
$my_query = new WP_Query('cat='. $category_id . '&' . 'offset=' . '&' . 'showposts='. $featured_number);
while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $the_post_ids = get_the_ID();
?>
<div class="featured-cat-meta post-<?php the_ID(); ?>">
<?php $values = get_post_custom_values("feat-cat-img"); if (isset($values[0])) { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("feat-cat-img"); echo $values[0]; ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } else { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo get_featcat_image(); ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="featured-cat-date">Posted On <?php the_time('l, F jS Y') ?> <?php edit_post_link('Edit'); ?></span>
<p><?php the_excerpt_feat_cat(); ?></p>
<div class="clearfix"></div>
</div><!-- FEATURED CATEGORY META <?php the_ID(); ?> END -->
<?php endwhile;?>
</div><!-- FEATURED CATEGORY 1 ENTRY END -->
<?php } ?>
<?php $featured_category = get_theme_option('featured_category_id2'); $featured_number = get_theme_option('featured_number2'); ?>
<?php if(($featured_category == 'Choose a category:') || ($featured_number == 'Number of post:')) { ?>
<?php { /* nothing */ } ?>
<?php } else { ?>
<div class="featured-cat-entry">
<h3> <?php $cat_id = get_cat_id($featured_category); $category = get_cat_name($cat_id); echo $category; ?></h3>
<?php
$category_id = get_cat_id($featured_category);
$my_query = new WP_Query('cat='. $category_id . '&' . 'offset=' . '&' . 'showposts='. $featured_number);
while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $the_post_ids = get_the_ID();
?>
<div class="featured-cat-meta post-<?php the_ID(); ?>">
<?php $values = get_post_custom_values("feat-cat-img"); if (isset($values[0])) { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("feat-cat-img"); echo $values[0]; ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } else { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo get_featcat_image(); ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="featured-cat-date">Posted On <?php the_time('l, F jS Y') ?> <?php edit_post_link('Edit'); ?></span>
<p><?php the_excerpt_feat_cat(); ?></p>
<div class="clearfix"></div>
</div><!-- FEATURED CATEGORY META <?php the_ID(); ?> END -->
<?php endwhile;?>
</div><!-- FEATURED CATEGORY 2 ENTRY END -->
<?php } ?>
</div><!-- FEATURED CATEGORY END -->
แทนที่ด้วย
<div id="featured-category">
<?php $featured_category = get_theme_option('featured_category_id1'); $featured_number = get_theme_option('featured_number1'); ?>
<?php if(($featured_category == 'Choose a category:') || ($featured_number == 'Number of post:')) { ?>
<?php { /* nothing */ } ?>
<?php } else { ?>
<div class="featured-cat-entry">
<h3> <?php $cat_id = get_cat_id($featured_category); $category = get_cat_name($cat_id); echo $category; ?></h3>
<?php
$category_id = get_cat_id($featured_category);
$my_query = new WP_Query('cat='. $category_id . '&' . 'offset=' . '&' . 'showposts='. $featured_number);
while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $the_post_ids = get_the_ID();
?>
<div class="featured-cat-meta post-<?php the_ID(); ?>">
<?php $values = get_post_custom_values("feat-cat-img"); if (isset($values[0])) { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("feat-cat-img"); echo $values[0]; ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } else { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo get_featcat_image(); ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="featured-cat-date">Posted On <?php the_time('l, F jS Y') ?> <?php edit_post_link('Edit'); ?></span>
<p><?php the_excerpt_feat_cat(); ?></p>
<div class="clearfix"></div>
</div><!-- FEATURED CATEGORY META <?php the_ID(); ?> END -->
<?php endwhile;?>
</div><!-- FEATURED CATEGORY 1 ENTRY END -->
<?php } ?>
<?php $featured_category = get_theme_option('featured_category_id2'); $featured_number = get_theme_option('featured_number2'); ?>
<?php if(($featured_category == 'Choose a category:') || ($featured_number == 'Number of post:')) { ?>
<?php { /* nothing */ } ?>
<?php } else { ?>
<div class="featured-cat-entry">
<h3> <?php $cat_id = get_cat_id($featured_category); $category = get_cat_name($cat_id); echo $category; ?></h3>
<?php
$category_id = get_cat_id($featured_category);
$my_query = new WP_Query('cat='. $category_id . '&' . 'offset=' . '&' . 'showposts='. $featured_number);
while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $the_post_ids = get_the_ID();
?>
<div class="featured-cat-meta post-<?php the_ID(); ?>">
<?php $values = get_post_custom_values("feat-cat-img"); if (isset($values[0])) { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("feat-cat-img"); echo $values[0]; ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } else { ?>
<div class="featured-cat-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo get_featcat_image(); ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
</div><!-- FEATURED CATEGORY IMAGE END -->
<?php } ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="featured-cat-date">Posted On <?php the_time('l, F jS Y') ?> <?php edit_post_link('Edit'); ?></span>
<p><?php the_excerpt_feat_cat(); ?></p>
<div class="clearfix"></div>
</div><!-- FEATURED CATEGORY META <?php the_ID(); ?> END -->
<?php endwhile;?>
</div><!-- FEATURED CATEGORY 2 ENTRY END -->
<?php } ?>
</div><!-- FEATURED CATEGORY END -->
เข้าใจว่า เป็นโค๊ดแบบเก่า จึงทำให้มันไม่ทำงาน
อ้างอิง http://pastebin.com/YjZkN640
ไปที่เว็บ http://pastebin.com/ เพื่อแปลงโค๊ด กด create new paste
สำคัญที่
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo get_featcat_image(); ?>" alt="<?php the_title(); ?>" width="50" height="50" /></a>
ส่วนการใส่โค๊ด
<!--<img src="<?php echo get_post_image(); ?>" alt="<?php the_title(); ?>" width="200" height="130" />
ต่อจาก <div class=”post-meta” id=”post-<?php the_ID(); ?>”>
ในการแก้รูปไม่โชว์หน้าเเรก หรือ achieve นั้น ทำให้ Relate post มันไป Disable โค๊ดอีกตัวที่ดึงรูป Thumbnail สำรอง(รูปขนาดล็กสุด) ที่เราได้ตั้งค่าไว้
หมายเหตุ
รูป thumbnail ของ เว็บโดยทั่วไป มี 3 ขนาด
ใหญ่ สำหรับ Slide Show ขนาดใหญ่
กลาง สำหรับ เมื่อกด Category หรือโชว์หน้าเเรก
เล็ก สำหรับ Relate post