WordPress プラグイン。最新の投稿記事に日付を付けたり、本文テキストの冒頭を抜粋して表示させたり出来ます。
4種類の関数(Functions)function c2c_get_recent_posts ($num_posts = 5, $format = "<li>%post_date%: %post_URL%</li>", $categories = '', $orderby = 'date', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false) function c2c_get_random_posts($num_posts = 5, $format = "<li>%post_date%: %post_URL%</li>", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false)
function c2c_get_recently_commented ($num_posts = 5, $format = "<li>%comments_URL%<br />%last_comment_date%<br />%comments_fancy%</li>", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y h:i a', $authors = '', $include_passworded_posts = false) function c2c_get_recently_modified ($num_posts = 5, $format = "<li>%post_URL%<br />Updated: %post_modified%</li>", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false) パラメータの説明
表示テンプレートに使える percent substitution tags とその説明
コード記述サンプル最新5件の記事を、日付(西暦.月.日):パーマリンク付き記事タイトル+改行して本文冒頭のn文字(後で説明/備忘録:カスタマイズした点)を降順で表示。(全ての投稿者の記事を表示/パスワード制限のページは表示しない:この2点は記述を省略)<?php if (function_exists('c2c_get_recent_posts')) { ?> <ul> <?php c2c_get_recent_posts() ?> </ul> 備忘録:カスタマイズした点記事本文から冒頭250文字(全角では125文字)までをリストに表示させるにはcustomizable-post-listings.php 146-151行目参照。下のソースはデフォルト。//-- Some things you might want to configure ----- $excerpt_words = 6; // Number of words to use for %post_excerpt_short% $excerpt_length = 50; // Number of characters to use for %post_excerpt_short%, only used if $excerpt_words is 0 $idmode = ‘nickname’; // how to present post author name $comment_fancy = array(’No comments’, ‘1 Comment’, ‘%comments_count% Comments’); //-- END configuration section ----- //-- Some things you might want to configure ----- $excerpt_words = 0; // Number of words to use for %post_excerpt_short% $excerpt_length = 250; // Number of characters to use for %post_excerpt_short%, only used if $excerpt_words is 0 $idmode = ‘nickname’; // how to present post author name $comment_fancy = array(’No comments’, ‘1 Comment’, ‘%comments_count% Comments’); //-- END configuration section ----- |
Archives >