WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] What was changed regarding building the comments? (18 posts)

  1. darkrage64
    Member
    Posted 1 year ago #

    Hi guys,

    since my update to 3.4.1 my comments are broken (their style and formatting, not their functionality).

    Avatars have the old "68px" setting in the img-part of the HTML code and some divs that I added between comments etc. are missing.

    When I set up WordPress with version 3.2.1 I used twentyeleven, duplicated it and used this to build my own theme. I changed a lot of things in my theme folder, including comments.php and functions.php.

    Example: In comments.php I added a seperator-line-graphic after <?php // You can start editing here -- including this comment! ?>.

    In functions.php in "twentyeleven_comment", line 513, I changed the size of the avatar to 32, "$avatar_size = 32;" etc.

    All those changes don't show up in my blog anymore. Even if I add some text it doesn't show up in the source of the page. It feels like if the files aren't used anymore to build the comments-html-markup.
    However, for pages like the categories or authors.php, it still works.

    The problem is visible here: http://www.mimimi-productions.de/?p=467

    Another thing that has changed is that before it was "One thought on ..." (as it says in my comments.php in my theme folder) and now it's "One comment on" (and I can't find this via "find in files").

    Any help is greatly appreciated!

    Cheers

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I changed a lot of things in my theme folder, including comments.php and functions.php.

    Then the issues are probably within your custom theme. Have you checked your site's error logs. Or turned debug on and enabled error logging?

  3. darkrage64
    Member
    Posted 1 year ago #

    Well, with a lot I meant a lot of small changes like adding a div somewhere. Everything is working fine, it's just that WP somehow doesn't use the comments and function.php from my theme anymore (and I don't understand where it's getting its HTML markup from).

    Nevertheless I'll try the debug mode etc.

  4. darkrage64
    Member
    Posted 1 year ago #

    That's all I get:

    Notice: add_custom_background is deprecated since version 3.4! Use add_theme_support( 'custom-background', $args ) instead. in /var/www/web1574/html/mimimi_prod/wp-includes/functions.php on line 2628
    
    Notice: add_custom_image_header is deprecated since version 3.4! Use add_theme_support( 'custom-header', $args ) instead. in /var/www/web1574/html/mimimi_prod/wp-includes/functions.php on line 2628

    What could cause that changes in my comments.php are not visible on my page anymore? It worked well before. And what is WP using instead of my theme file now?

    I guess that somehow my "twentyeleven_comment()" is not used anymore. Because this is the method that involves both the avatar size AND the comments.php changes.

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    What happens if you remove or rename twentyeleven_comment() in your functions.php?

  6. darkrage64
    Member
    Posted 1 year ago #

    Absolutely nothing. I also tried playing around with the check for the function itself, but nothing changed. Renaming the function.php itself (to make sure that it's used at all) trashes the site. So somehow the comment method doesn't get called.

    I read something about changes regarding child themes in the change logs and this term is also used here:

    if ( ! function_exists( 'twentyeleven_comment' ) ) :
    /**
     * Template for comments and pingbacks.
     *
     * To override this walker in a child theme without modifying the comments template
     * simply create your own twentyeleven_comment(), and that function will be used instead.
     *
     * Used as a callback by wp_list_comments() for displaying the comments.
     *
     * @since Twenty Eleven 1.0
     */
  7. darkrage64
    Member
    Posted 1 year ago #

    Okay, I checked again.

    I am 100% sure that both my comments.php and twentyeleven_comment method are not used at all. Removing my theme's comments.php from the server has no effect.

    So ... as I only updated WP, somehow the connection must be broken or not set up correctly.

    EDIT:
    I think WP is using this file instead:
    \wp-includes\theme-compat\comments.php
    Does it do this because of the deprecated warnings?

    EDIT2:
    No, it isn't. I just can't find the file it's using instead ...

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    My guess is that your theme is using the inbuilt/core comments functionality. That suggest there's an issue in your theme somewhere relating to comments.

    Does it do this because of the deprecated warnings?

    Nope. Warnings are just that - warnings. The only time WP falls back to using core functionality is when there's a serious issue in a theme template file or one of its functions.

  9. darkrage64
    Member
    Posted 1 year ago #

    My theme is completely using the twentyeleven theme and only changes small parts of it. Nothing related to function calls or similar.

    I never touched scripts outside of the theme folder to be able to update WP without such issues.

    Do you have a tip how I can get it working again? This is really annoying and I don't know where to search. Usually I do a "Find in files" and search for a specific HTML markup in all source files. But I simply can't find the file / part that currently generates the comments.

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    Why don't you try creating a child theme of Twenty Eleven and start porting your changes only over to the new child theme?

  11. darkrage64
    Member
    Posted 1 year ago #

    I never used the child theme stuff and I don't want to touch everything again ... this would cost a lot of time and therefore money (this is not a hobby page or similar). It just needs to be up and running again.

    As long as I could understand what's broken it should be easy to fix. Maybe I should open a new thread that starts off with the results we found here, asking how the comments.php from themes are called.

  12. esmi
    Forum Moderator
    Posted 1 year ago #

    If you start a new topic now, I can almost guarantee that it will be deleted. It's really very simple - there's an issue with your theme's comments.php or your call to it that is causing WP to fallback to the default core comment functionality.

  13. darkrage64
    Member
    Posted 1 year ago #

    Okay.

    - Issue with comments.php:
    No. I replaced the file with the default twentyeleven one. I also did this for the functions.php. Both files can't be the issue, as this changed nothing. They also never have been touched after the initial setup and the update shouldn't change them.

    - Where is the "call to it"? How can I check if it is called?
    Even if I put garbage in my comments.php it changes nothing. If I do this with the functions.php the site is down. So functions.php from the theme folder is definitely used, comments.php definitely not.

    - Where exactly is the default core comment functionality located?
    What part of WP generates this snippet?

    <h2 id="comments-title">
     One comment on

    I can't find it.

  14. esmi
    Forum Moderator
    Posted 1 year ago #

    Where is the "call to it"?

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

    And the code you posted above is, presumably, being generated by your comments.php file.

  15. darkrage64
    Member
    Posted 1 year ago #

    This code was generated by my comments.php file in the theme folder. But again, this file isn't used at all since I updated.

    That's the broken part that I am trying to find ;)

    So my single.php it looks like this:

    <div id="primary">
    			<div id="content" role="main" class="leftcol">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', 'single' ); ?>
    
    					<?php comments_template( '', true ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->

    Removing the <?php comments_template( '', true ); ?> call removes all the comments, so this seems to be the right direction ...

  16. darkrage64
    Member
    Posted 1 year ago #

    Okay, echoing the address the $file is using shows me that there's a plugin that is overwriting my comments.php-link.

    I still need to check if this was always the case or maybe it was related to updating the specific plugin. Very annoying.

  17. darkrage64
    Member
    Posted 1 year ago #

    So it turns out that the plugin "Spam Free WordPress" had an update which adds its own comments.php, which completely overwrites the theme's file.

    I removed the plugin and everything is working fine again.

    Thank you very much for helping me with this, esmi. I wouldn't have been able to find the issue without you telling me where the comments are generated.

  18. esmi
    Forum Moderator
    Posted 1 year ago #

    Glad to hear that you managed to track the culprit down. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic