TOPページに記事一覧表示の際のカテゴリーリンクについて
-
TOPページに記事一覧を表示させるために以下のphpを記述して表示させています。
現在では、個々の記事の日付、カテゴリー名、その下に記事タイトルを表示しています。カテゴリー名には、カテゴリーの記事一覧へのリンクとなって表示されるのですが、
今回リンク無しでカテゴリー名のみの表示にさせたいと思っています。
色々試してもうまくいかず困っています。。phpにはどの様な加工が必要でしょうか?そして、これはもし出来ればなのですが、上記を表示させる時にも参考にした以下のサイトのサンプルの様に、カテゴリー名はアイコンで表示させたいのですが、どの様な方法が考えられますでしょうか?
参考サイト
以下の「②トップページに記事一覧を表示」の辺り
http://www.doya-doya.com/word-press/2012/01/26/8615宜しくお願い致します。
<ul> <?php // ▽ポストタイプとタクソノミーを入力 $post_type = 'post'; $taxonomy = 'category'; // △ $args=array( 'post_type' => $post_type, 'post_status' => 'publish', 'posts_per_page' => 4, 'orderby' => 'date', 'order' => DESC, 'caller_get_posts'=> 1 ); $my_posts = get_posts($args); foreach ($my_posts as $post) { setup_postdata($post); $post_title = $post->post_title; ?> <li class="odd"> <span class='date'><?php the_time('Y.m.d'); ?></span> <?php $terms = get_the_terms( $post->ID, $taxonomy ); if ( $terms && ! is_wp_error( $terms ) ) : $draught_links = array(); foreach ( $terms as $term ) { echo '<a class="' . $term->slug . '" href="' . home_url( '/' ) . $term->taxonomy .'/'. $term->slug . '">' . $term->name . '</a>'; } endif; $days=7; $today=date('U'); $entry=get_the_time('U'); $diff1=date('U',($today - $entry))/86400; if ($days > $diff1) { echo '<img src="http://***/img/new.gif" alt="New" />'; } ?> </span><br /> <a href="<?php the_permalink();?>"><?php the_title(); ?></span></a> </li> <?php } ?> </ul>
4件の返信を表示中 - 1 - 4件目 (全4件中)
4件の返信を表示中 - 1 - 4件目 (全4件中)
- トピック「TOPページに記事一覧表示の際のカテゴリーリンクについて」には新たに返信することはできません。