Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Functions.php:
- // *** Comments on/off
- $wp_customize->add_section( 'display_comments', array(
- 'title' => 'Comments',
- 'priority' => 36,
- ) );
- $wp_customize->add_setting( 'mytheme_comments' );
- $wp_customize->add_control( 'mytheme_comments', array(
- 'label' => 'Comments on or off',
- 'section' => 'display_comments',
- 'type' => 'select',
- 'default' => On,
- 'choices' => array(
- 'value1' => On,
- 'value2' => Off,
- ),
- ) );
- Single.php:
- <?php $var = get_theme_mod('mytheme_comments');
- if ($var == 'On') {
- comments_template();
- } else if ($var == 'Off') {
- // Var is Off
- } else {
- comments_template();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement