Ads by Google
--/--/-- (--)
新しい記事を書く事で広告が消せます。
function sc_bloginfo($atts, $content = null) {
extract(shortcode_atts(array(
'arg' => ''
), $atts));
return get_bloginfo($arg);
}
add_shortcode('bloginfo', 'sc_bloginfo');
<img src="[bloginfo arg="template_url"]/img/sample.jpg" alt="" />
<img src"http://www.example.com/wp-content/themes/default/img/sample.jpg" alt="" />
function sc_list($atts, $content = null) {
global $post;
$cur_cat = array_shift(get_the_category());
extract(shortcode_atts(array(
'num' => 5,
'cat' => $cur_cat->cat_ID,
'format' => 'Y/m/d'
), $atts));
$myposts = get_posts('numberposts=' . $num . '&order=DESC&orderby=post_date&category=' . $cat);
$ret = '';
foreach ($myposts as $post) {
setup_postdata($post);
$ret .= sprintf('<li><a href="%s">%s</a> <span class="published">%s</span></li>',
get_permalink(),
get_the_title(),
get_the_time($format));
}
return $ret;
}
[list /]
[list num="3" cat="2"]