Last active
December 10, 2023 05:04
-
-
Save 867/2e0533f689eee7b208cef3e0f889500b to your computer and use it in GitHub Desktop.
Snow-Monkey:カスタム投稿タイプのタクソノミーターム一覧をアクションフック内に表示する
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 | |
/** | |
* アーカイブページのエントリーコンテンツの後にカスタム投稿タイプのタクソノミーターム一覧を出力する | |
*/ | |
add_action( | |
'snow_monkey_after_archive_entry_content', | |
function() { | |
$post_type = get_post_type(); | |
$args = array( | |
'taxonomy' => 'blog-cat', | |
'hide_empty' => true, | |
); | |
if( 'blog' === $post_type ) { | |
$terms = get_terms( $args ); | |
if( $terms && !is_wp_error( $terms ) ) { | |
echo '<ul class="">'."\n"; | |
echo walk_category_tree( $terms, 0, array( | |
'use_desc_for_title' => false, | |
'style' => 'list', | |
)); | |
echo '</ul>'."\n"; | |
} | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment