
Untitled
By: a guest on
Oct 12th, 2012 | syntax:
None | size: 0.76 KB | hits: 20 | expires: Never
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();
}
?>