PHP Warnings: Count ()
-
Wordpress 5.7 – Hueman Free 3.7.6
Getting the following errors:[30-Mar-2021 13:17:42 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/youtellmetexas/public_html/wp-content/themes/hueman/comments.php on line 10 [30-Mar-2021 13:17:42 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/youtellmetexas/public_html/wp-content/themes/hueman/comments.php on line 11
The lines in question are:
<li class="active"><a href="#commentlist-container"><i class="far fa-comments"></i><?php _e( 'Comments', 'hueman' ); ?><span><?php echo count($wp_query->comments_by_type['comment']); ?></span></a></li> <li><a href="#pinglist-container"><i class="fas fa-share"></i><?php _e( 'Pingbacks', 'hueman' ); ?><span><?php echo count($wp_query->comments_by_type['pings']); ?></span></a></li>
There are issues with count() in the newer versions of PHP. The release notes for the 3.7x say the code is PHP 8 friendly. This is apparently not the case here. Please advise as to how to modify the comments.php file to avoid the warnings.
Thanks!The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Warnings: Count ()’ is closed to new replies.