Skip to content

Instantly share code, notes, and snippets.

@akiya64
Created February 6, 2017 04:21
Show Gist options
  • Save akiya64/b72924ed0392061b4cb972b71f640dd2 to your computer and use it in GitHub Desktop.
Save akiya64/b72924ed0392061b4cb972b71f640dd2 to your computer and use it in GitHub Desktop.
Switch Excerpt
add_action ( 'edit_category_form_fields', 'extra_category_fields');
function extra_category_fields( $tag ) {
$tid = $tag->term_id;
$is_show_excerpt = get_option( "cat_$tid_show_excerpt");
?>
<tr class="form-field">
<th><label for="extra_text">抜粋を表示</label></th>
<td>
<select name="is_show_exception" id="is_show_exception">
<?php if($is_show_excerpt): ?>
<option value="true">はい</option>
<option value="false" selected>いいえ</option>
<?php else: ?>
<option value="true" selected>はい</option>
<option value="false">いいえ</option>
<?php endif: ?>
</select>
<p class="description">カテゴリーページの時、抜粋を表示します。</td>
</tr>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment