我正在使用以下函数创建一个快捷码,用于显示post类型存档的下拉列表:
// Email Archives Shortcode
function email_archives_shortcode() { ?>
<select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
<option value=""><?php echo esc_attr( __( \'Select Month\' ) ); ?></option>
<?php wp_get_archives( array( \'type\' => \'monthly\', \'format\' => \'option\', \'show_post_count\' => 1, \'post_type\' => \'emails\' ) ); ?>
</select>
<?php }
add_shortcode(\'email-archives\', \'email_archives_shortcode\');
它工作得很好,除非我在小部件中插入短代码,它显示在小部件标题上方,而不是下方。