-
-
自身のWordPressに「HUNTER」を入れるコード
どうも、特別限定テーマを「HUNTER」なんて名前にしたばかりに、 全くエゴサーチできない「ENJI」です。 さて、この度STINGER3に少しオプションを追加したWordPressテーマ 「HUNT ...
-
-
「HUNTER」のfunctions.phpの修正コード
先日記事にしましたHUNTER用のfunctions.phpで、 更新する度にアマゾンのコードが消えるという不具合を頂きました。 申し訳ありません。 以下、修正しまいしたのでfunctions.php ...
-
-
関連記事をランダム表示に
2013/09/16 -custom
single.phpの<関連記事>の該当箇所を 以下の様にごっそり変えて下さい
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354<!--関連記事--><h4 class="kanren">関連記事</h4><div class="sumbox02"><div id="topnews"><div><?php$categories = get_the_category($post->ID);$category_ID = array();foreach($categories as $category):array_push( $category_ID, $category -> cat_ID);endforeach ;$args = array('post__not_in' => array($post -> ID),'posts_per_page'=> 5,'category__in' => $category_ID,'orderby' => 'rand',);$st_query = new WP_Query($args); ?><?phpif( $st_query -> have_posts() ): ?><?phpwhile ($st_query -> have_posts()) : $st_query -> the_post(); ?><dl><dt><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php if ( has_post_thumbnail() ): // サムネイルを持っているときの処理 ?><?php echo get_the_post_thumbnail($post->ID, 'thumb110'); ?><?php else: // サムネイルを持っていないときの処理 ?><img src="<?php echo get_template_directory_uri(); ?>/images/no-img.png" alt="no image" title="no image" width="110px" /><?php endif; ?></a></dt><dd><h4 class="saisin"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4><p class="basui"><?php echo mb_substr(strip_tags(akita_noshotcode($post-> post_content)),0,35).'...'; ?></p><p class="motto"><a href="<?php the_permalink(); ?>">記事を読む</a></p></dd></dl><?php endwhile;?><?php else:?><p>記事はありませんでした</p><?phpendif;wp_reset_postdata();?></div></div></div><!--/関連記事-->