Skip to content

Commit

Permalink
Re-add global post/page comments settings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlxMedia committed Jul 21, 2018
1 parent 3fa0822 commit 2dd4d22
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions functions/theme-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@
's1-s2' => esc_attr__( 'Hide both sidebars', 'enspire' ),
),
) );
// General: Post Comments
Kirki::add_field( 'alx_theme', array(
'type' => 'switch',
'settings' => 'post-comments',
'label' => esc_attr__( 'Post Comments', 'enspire' ),
'description' => esc_attr__( 'Comments on posts', 'enspire' ),
'section' => 'general',
'default' => 'on',
) );
// General: Page Comments
Kirki::add_field( 'alx_theme', array(
'type' => 'switch',
'settings' => 'page-comments',
'label' => esc_attr__( 'Page Comments', 'enspire' ),
'description' => esc_attr__( 'Comments on pages', 'enspire' ),
'section' => 'general',
'default' => 'off',
) );
// General: Recommended Plugins
Kirki::add_field( 'enspire_theme', array(
'type' => 'switch',
Expand Down
2 changes: 1 addition & 1 deletion page-templates/child-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

</article>

<?php if ( comments_open() || get_comments_number() ) : comments_template( '/comments.php', true ); endif; ?>
<?php if ( get_theme_mod( 'page-comments', 'off' ) == 'on' ) { comments_template('/comments.php',true); } ?>

<?php endwhile; ?>

Expand Down
2 changes: 1 addition & 1 deletion page.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

</article>

<?php if ( comments_open() || get_comments_number() ) : comments_template( '/comments.php', true ); endif; ?>
<?php if ( get_theme_mod( 'page-comments', 'off' ) == 'on' ) { comments_template('/comments.php',true); } ?>

<?php endwhile; ?>

Expand Down
2 changes: 1 addition & 1 deletion single.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<?php if ( get_theme_mod( 'related-posts', 'categories' ) != 'disable' ) { get_template_part('inc/related-posts'); } ?>

<?php if ( comments_open() || get_comments_number() ) : comments_template( '/comments.php', true ); endif; ?>
<?php if ( get_theme_mod( 'post-comments', 'on' ) == 'on' ) { comments_template('/comments.php',true); } ?>

</div><!--/.pad-->
</div><!--/.content-->
Expand Down

0 comments on commit 2dd4d22

Please sign in to comment.