目標
WordPress popular posts 以下WPP を使用しています
普通に記事を呼び出す事はできるのですが、この度、カテゴリごとに記事カードの色を変えたいと思っています
つまり、htmlにおける
html
1<span class="cat-name cat-id-<?php echo $cat->cat_ID;?>"></span>
というようなclassを付与したいのですが、
現状
WPPを読み出すクエリの中に(php文の中にhtmlを書いている)ため
php
1<?php 2wpp_get_mostpopular( 3 array( 4 // PV集計期間(daily, weekly, monthly, all から選べます) 5 'range' => 'last14days', 6 7 'title_length'=>'35', 8 // PV数順で並び替え(comments を指定するとコメント順になります) 9 'order_by' => 'views', 10 11 // post OR page 12 'post_type' => 'post', 13 14 'pid'=>'2661,2658,2716,2694', 15 // 表示数 16 'limit' => 30, 17 18 19 // 閲覧数表示するか(1なら表示、 0なら非表示) 20 'stats_views' => '0', 21 22 // HTMLのラッパー 開始タグ 23 'wpp_start' => '<div class="wpp-posts-container">', 24 25 // HTMLのラッパー 終了タグ 26 'wpp_end' => '</div>', 27 28 // サムネイル画像の幅 29 'thumbnail_width' => '480', 30 31 // サムネイル画像の高さ 32 'thumbnail_height' => '300', 33 34 // 投稿日時表示 35 'stats_date' => true, 36 'stats_date_format' => 'Y/m/d', 37 'stats_category' => true, 38 39 'stats_author' => true, 40 41 // HTML部分 42 'post_html' => ' 43<div class="post-list-magazine"> 44 <article class="post-list"> 45 <div class = "wpp-card"> 46 <header> 47 <div class="post-thumbnail">{thumb}</div> 48 </header> 49 <section class="p"> 50 <div class="wpp-card-title"> <h2>{title}</h2></div> 51 52 <span class="wpp-meta post-stats">{stats}</span> 53 </section> 54 </div> 55 </article> 56</div>' 57 ) 58); 59?>
このwpp-cardのところにカテゴリを代表する(idなど)挿入できたらいいのですが、実際にはphpをphpで挟むことになってしまい、それができません
どなたか良いほうほうをご存知でしょうか、よろしくお願いいたします
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/09 15:13