CSスコアブックの関連記事のタイトルリストのショートコード

CSスコアブックの関連記事のタイトルリストのショートコード。
CSスコアブックの試合記録の関連記事のリスト。

function.php(子テーマのfunction.phpでも可)に下記のコードを記述する。

[php]
/**
* ショートコード-CSスコアブックサイト内関連記事リスト表示
*/

function list01($atts) {
extract(shortcode_atts(array(
“num” => ‘100’,
“tax” => ”,
“term” => ”,
), $atts));
global $post;
$myposts = get_posts(‘numberposts=’.$num.’&order=DESC&orderby=post_date&taxonomy=’.$tax.’&term=’.$term);
$retour=’

    ‘;
    foreach($myposts as $post) :
    setup_postdata($post);
    $retour.=’

  • ‘.get_the_time(‘Y/m/d’).’:‘.the_title(“”,””,false).’‘.get_comments_number_text(“”,”(1件のコメント)”,”(%件のコメント)”,””).’
  • ‘;
    endforeach;
    $retour.=’

‘;
wp_reset_postdata();
return $retour;
}
add_shortcode(“scorebook_list01”, “list01″);
[/php]

試合記録の場合
[php]
[scorebook_list01 tax=”match_code” term=””]
[/php]

クラブ別の場合。
[php]
[scorebook_list01 tax=”clubname” term=””]
[/php]

スタジアム別の場合
[php]
[scorebook_list01 tax=”stadiumname” term=””]
[/php]

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です