List category postsを使って、日付と記事タイトルのみを表示させたい場合、ショートコードは
ですが、デフォルトでは、記事タイトル→日付の順に表示されます。
これを逆にして、日付→記事タイトルの順にしたい。
List category postsのテンプレートシステムを使います。
テンプレートシステムの使い方は「List category postsのタイトルを表示しない」と同じです。
「default.php」を別名(例:news_ichiran.php)でテーマフォルダに保存したものを開きます。
Show dateが、Show the title and link to the postより下になっていますので、
Show dateを、Show the title and link to the postより上に移動します。
//Show date:
$lcp_display_output .= ‘ ‘ . $this->get_date($single);
//Show the title and link to the post:
$lcp_display_output .= $this->get_post_title($single);
これで、ショートコードを
とすれば、
news_ichiran.phpが適用され、日付→記事タイトルの順になります。
同じWPサイトの中で複数のカテゴリーの最新記事をトップページで表示させたい、
さらに例えば
「List category postsのタイトルを表示しない」
「List category postsの表示項目の順番を入れ替える」
という2つのスタイルで使いたい場合は、
テンプレートシステム作成の方法で、テーマフォルダ内に2つテンプレートを作り、
ショートコードの「template=」でそれぞれを設定すればOKです。
追記:日付とタイトルの間を開けるには、テンプレートのタイトル部分に半角スペースを追加。
//Show the title and link to the post:
$lcp_display_output .= $this->get_post_title($single, ‘h4’, ‘lcp_post’);
↓
//Show the title and link to the post:
$lcp_display_output .= ‘ ’ . $this->get_post_title($single, ‘h4’, ‘lcp_post’);