Support » Theme: WP-Forge » Remove all comments

  • Resolved olimax

    (@olimax)


    Any suggestions as to how to remove all comments
    I normally use the ‘Disable Comments’ plugin but that throws an error with this theme
    Undefined index: WP_Widget_Recent_Comments in .... \htdocs\wp-content\themes\wp-forge\functions.php on line 520
    It works with standard themes
    Many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author ThemeAWESOME

    (@tsquez)

    Hi there,

    WP-Forge is a standard theme, if it wasn’t it wouldn’t be in the repository. I believe that error is caused by a function that removes the default stylings of the recent comment widget.

    You can do one of two things: You can comment out that portion of functions.php which is this:

    /**
     * Removes recent comments styling injected into header by WordPress - Styles moved to style sheet
     * @since WP-Forge 5.5.1.7
     */
    if ( ! function_exists( 'wpforge_remove_recent_comments_style' ) ) {
    	function wpforge_remove_recent_comments_style() {
    		global $wp_widget_factory;
    		remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
    	}
    

    to this:

    /**
     * Removes recent comments styling injected into header by WordPress - Styles moved to style sheet
     * @since WP-Forge 5.5.1.7
     */
    //if ( ! function_exists( 'wpforge_remove_recent_comments_style' ) ) {
    //	function wpforge_remove_recent_comments_style() {
    //		global $wp_widget_factory;
    //		remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
    //	}
    //	add_action( 'widgets_init', 'wpforge_remove_recent_comments_style' );
    //}
    

    and then use the plugin you referred to above to remove comments, or…

    you could open up single.php and comment out the following:

    <?php comments_template( '', true ); ?>

    like so:

    <?php // comments_template( '', true ); ?>

    Entirely up to you how want to do it. I do hope that you are using a child theme, if not, of course as you know, when you update you will lose those edits.

    Hope this help.

    • This reply was modified 4 years, 1 month ago by ThemeAWESOME.

    Thanks you so much for a swift and comprehensive response
    In the end, as I was removing comments across the board, I just used this

    if (class_exists('Disable_Comments')) 
    {
    	function wpforge_remove_recent_comments_style() 
    	{
    		return;
    	}
    }

    It would be easy to just remove the comments from the front end templates but the plugin has the advantage of removing all the baggage from the admin too

    I have always though that the option to have comments or not should be in the core
    They are generally ugly and superfluous to many developers now WP is far more a CMS than just a blog. The fact that nearly 1 million have downloaded that plugin is testimony to that

    I have been on the WP-Forge mailing list for ages and have finally got around to giving it a go on a new site. It looks a great clean starter theme with a few class features
    I have only just had a brief run at it so far but it appears to be elegantly coded and well thought through. Thank you so much

    Theme Author ThemeAWESOME

    (@tsquez)

    Awesome! You are very welcome. Glad we got it sorted out.

    I’m happy you finally gave WP-Forge a try, I greatly appreciate that and thank you for the kind words.

    If there is anything else I can assist with, please do not hesitate to let me know. I’ll do my best to provide an answer.

    Also, if possible, please leave a rating and review of WP-Forge and let everyone know what you think.

    Thanks again.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove all comments’ is closed to new replies.