add_shortcode( ‘comments’, function( $atts = array(), $content = ” )
{
if( is_singular() && post_type_supports( get_post_type(), ‘comments’ ) )
{
ob_start();
comments_template();
add_filter( ‘comments_open’, ‘wpse_comments_open’ );
add_filter( ‘get_comments_number’, ‘wpse_comments_number’ );
return ob_get_clean();
}
return ”;
}, 10, 2 );
function wpse_comments_open( $open )
{
remove_filter( current_filter(), __FUNCTION__ );
return false;
}
function wpse_comments_number( $open )
{
remove_filter( current_filter(), __FUNCTION__ );
return 0;
}
Description:
This let’s us make a shortcode for our plugin.
Our wpDiscuz shortcode is [ comments ]
Insert this shortcode wherever you’d like to display a comment section.
This is Optional. It stops the navigation from showing up on your homepage (don’t use this if your comic page will be your home page).
add_action( ‘wp_head’, function () { ?>
<style>
body.home .floating_links {
display: none;
}
</style>
<?php } );
Description:
Hide floating links on Homepage
This is Optional. It just hides the admin bar for your readers when they are logged in to their wordpress.
add_action(‘after_setup_theme’, ‘remove_admin_bar’);
function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {
show_admin_bar(false);
}
}
Description:
Show Admin Bar only to you