Change template of WordPress comment-page

I want to show the_content() only in The first page of each post, and I don't want to show the_content() in comment-page when "Break comments into pages..." enabled.

Is there a Way?









Topic paginate-comments-links Wordpress

Category Web


For comment pages, the WP_Query-var cpage is set, telling us which comment page we're on, making it is possible to filter the content for comment pages like this:

add_filter('the_content', 'comment_page_hide_content');
function comment_page_hide_content($content) {
    global $wp_query;
    if ($wp_query->get('cpage') > 1){ // Greater than one, because 1 inducates the first comment page
        $content = "";
    }
    return $content;
}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.