bumsos
フォーラムへの返信
-
フォーラム: プラグイン
返信が含まれるトピック: WP-PostViewsでカテゴリとタグの表示201〜212行目の所に
$post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
$thumbnail = get_the_post_thumbnail($post->ID, array(210,140), array(‘alt’=>$post_title, ‘title’=>$post_title));
$tag = get_the_tags($post->ID);
$temp = stripslashes($views_options[‘most_viewed_template’]);
$temp = str_replace(“%VIEW_COUNT%”, number_format_i18n($post_views), $temp);
$temp = str_replace(“%POST_TITLE%”, $post_title, $temp);
$temp = str_replace(“%POST_EXCERPT%”, $post_excerpt, $temp);
$temp = str_replace(“%POST_CONTENT%”, $post->post_content, $temp);
$temp = str_replace(“%POST_URL%”, get_permalink($post), $temp);
$temp = str_replace(“%THUMBNAIL%”, $thumbnail, $temp);
$temp = str_replace(“%TAG%”, $tag, $temp);
$output .= $temp;太字部分を追加してみましたが、Arrayと表示されてしまいます。
どこがいけないのでしょう。。。フォーラム: プラグイン
返信が含まれるトピック: Popular Postsでのカテゴリ表示wordpress-popular-posts.php の
この部分(1184〜1192行)// category if ( $instance['stats_tag']['category'] ) { $post_cat = get_the_category( $p->id ); $post_cat = ( isset($post_cat[0]) ) ? '<a href="'.get_category_link($post_cat[0]->term_id ).'">'.$post_cat[0]->cat_name.'</a>' : ''; if ( $post_cat != '' ) { $stats .= ($stats == "") ? "<span class=\"wpp-category\">" . __('under', 'wordpress-popular-posts'). " {$post_cat}</span>" : " | <span class=\"wpp-category\">" . __('under', 'wordpress-popular-posts') . " {$post_cat}</span>"; } }
を編集すれば良いのだと思うのですが、
・どう変えれば良いのでしょうか。
よろしくお願いします。フォーラム: 使い方全般
返信が含まれるトピック: 親カテゴリの名前の付け方によって階層構造が上手く表示されないフォーラム: 使い方全般
返信が含まれるトピック: 親カテゴリの名前の付け方によって階層構造が上手く表示されないjdbbさん
理解不足ですいません。
$cat = $cat[0];
を削除しましたが
h2タグ内が表示されないままの状態です。現在このようになっています。
$cat = get_category(get_query_var('cat')); $id = $cat->category_parent ? $cat->category_parent : $cat->cat_ID; $children = wp_list_categories('echo=0&title_li=&child_of=' . $id); if( ! preg_match('/(カテゴリーなし|No categories)/', $children) ) { echo "<h2>"; $cat = get_the_category($id); { echo $cat->cat_name; }; echo "</h2>"; echo "<ul>"; echo $children; echo "</ul>";
よろしくお願いします。
フォーラム: 使い方全般
返信が含まれるトピック: 親カテゴリの名前の付け方によって階層構造が上手く表示されないjdbbさん
回答ありがとうございます。フルーツの部分が
echo “<h2>”;
$cat = get_the_category(); $cat = $cat[0]; { echo $cat->cat_name; };
echo “</h2>”;
この部分だとした場合ですが言葉足らずで申し訳ありません。想像いただいた通りです。
ご指摘のあった、6行目
$cat = get_the_category();を
$cat = get_the_category(id);に
しました。しかし、状況を改善できず、h2タグ内が表示されなくなってしまいます。
どうしたものでしょうか。フォーラム: 使い方全般
返信が含まれるトピック: singleページでのカテゴリ表示