Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function simple_sitemap(){ | |
global $wpdb; | |
$args = array('depth' => 0, | |
'show_date' => NULL, | |
'date_format' => get_option('date_format'), | |
'child_of' => 0, | |
'exclude' => NULL, | |
'include' => NULL, | |
'title_li' => '<span class="subheader">固定ページの一覧</span>', | |
'echo' => 1, | |
'authors' => NULL, | |
'sort_column' => 'menu_order, post_title', | |
'link_before' => NULL, | |
'link_after' => NULL, | |
'exclude_tree' => NULL ); | |
echo '<div id="sitemap"><ul>'; | |
wp_list_pages($args); | |
echo '</ul>'; | |
$args = array('show_option_all' => NULL, | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'show_last_update' => 0, | |
'style' => 'list', | |
'show_count' => 0, | |
'hide_empty' => 1, | |
'use_desc_for_title' => 1, | |
'child_of' => 0, | |
'feed' => NULL, | |
'feed_type' => NULL, | |
'feed_image' => NULL, | |
'exclude' => NULL, | |
'exclude_tree' => NULL, | |
'include' => NULL, | |
'hierarchical' => true, | |
'title_li' => '<span class="subheader">記事カテゴリ</span>', | |
'number' => NULL, | |
'echo' => 1, | |
'depth' => 0, | |
'current_category' => 0, | |
'pad_counts' => 0, | |
'taxonomy' => 'category', | |
'walker' => 'Walker_Category' ); | |
echo '<ul>'; | |
echo wp_list_categories( $args ); | |
echo '</ul>'; | |
echo '</div>'; | |
} | |
add_shortcode('sitemap', 'simple_sitemap'); | |
?> | |
/*ショートコードで[sitemap]と書くだけ*/ |
Screen shot
Note
Description | カテゴリと固定ページのリンクのみのサイトマップをショートコードで抽出する |
---|---|
WordPress Ver. | 3.3.1 |
Via | WordPress Simple Sitemap |