After a prompt from Westi I added a…

After a prompt from Westi I added a note to Comments template standards on the Theme Development Codex page today.

The comments.php template file shouldn’t contain function defines unless in a function_exist() check. Ideally all functions should be in functions.php.

Example case: If comments.php contains function defines and the attachment.php loopLoop The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags. Any HTML or PHP code in the Loop will be processed on each post. https://codex.wordpress.org/The_Loop. assumes only one attachment to display and calls comment_template() each time round, you will get function redefines and fatal PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php. errors for “cannot redeclare this function that was previously declared.”

#comments, #standards