Advertisement
Guest User

Untitled

a guest
Oct 12th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Functions.php:
  2.  
  3. // *** Comments on/off
  4.  
  5. $wp_customize->add_section( 'display_comments', array(
  6. 'title' => 'Comments',
  7. 'priority' => 36,
  8. ) );
  9.  
  10. $wp_customize->add_setting( 'mytheme_comments' );
  11.  
  12. $wp_customize->add_control( 'mytheme_comments', array(
  13. 'label' => 'Comments on or off',
  14. 'section' => 'display_comments',
  15. 'type' => 'select',
  16. 'default' => On,
  17. 'choices' => array(
  18. 'value1' => On,
  19. 'value2' => Off,
  20. ),
  21. ) );
  22.  
  23. Single.php:
  24.  
  25. <?php $var = get_theme_mod('mytheme_comments');
  26. if ($var == 'On') {
  27. comments_template();
  28. } else if ($var == 'Off') {
  29. // Var is Off
  30. } else {
  31. comments_template();
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement