Skip to content

Instantly share code, notes, and snippets.

@furahaclothing
Created August 10, 2012 09:05
Show Gist options
  • Save furahaclothing/3312764 to your computer and use it in GitHub Desktop.
Save furahaclothing/3312764 to your computer and use it in GitHub Desktop.
カスタム投稿の月別アーカイブ-sidebar.php-
<?php
if (!is_home() && !is_page() || is_page_template() ) {
echo '<h2 class="posttype-' .get_post_type(). '">';
if ( get_post_type() === 'post' ){
echo 'カスタム投稿タイプが「post」のときのタイトル';
} else {
$customPostTypeObj = get_post_type_object(get_post_type());
echo esc_html($customPostTypeObj->labels->name);
}
echo '</h2>';
echo '<ul>';
wp_get_archives('type=monthly&post_type=' .get_post_type(). '');
echo '</ul>';
}?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment