Support » Fixing WordPress » count(): Parameter must be an array or an object that implements

  • Resolved renato.barone

    (@renatobarone)


    Hi someone please can help me?
    
    I've updated the PHP to 7.4 and I got this error message:
    count(): Parameter must be an array or an object that implements Countable in ………………… on line 216
    
    The function is: 
    
    // Return custom sidebars list, prepended inherit and main sidebars item (if need)
    if ( !function_exists( 'custom_made_get_list_sidebars' ) ) {
    	function custom_made_get_list_sidebars($prepend_inherit=false) {
    		if (($list = custom_made_storage_get('list_sidebars'))=='') {
    			$list = apply_filters('custom_made_filter_list_sidebars', array(
    				'sidebar_widgets'		=> esc_html__('Sidebar Widgets', 'custom-made'),
    				'header_widgets'		=> esc_html__('Header Widgets', 'custom-made'),
    				'above_page_widgets'	=> esc_html__('Above Page Widgets', 'custom-made'),
    				'above_content_widgets' => esc_html__('Above Content Widgets', 'custom-made'),
    				'below_content_widgets' => esc_html__('Below Content Widgets', 'custom-made'),
    				'below_page_widgets' 	=> esc_html__('Below Page Widgets', 'custom-made'),
    				'footer_widgets'		=> esc_html__('Footer Widgets', 'custom-made')
    				)
    			);
    			$custom_sidebars_number = max(0, min(2, custom_made_get_theme_setting('custom_sidebars')));
    <strong>			if (count($custom_sidebars_number) > 0) {</strong>
    				for ($i=1; $i <= $custom_sidebars_number; $i++) {
    					$list['custom_widgets_'.intval($i)] = sprintf(esc_html__('Custom Widgets %d', 'custom-made'), $i);
    				}
    			}
    			custom_made_storage_set('list_sidebars', $list);
    		}
    		return $prepend_inherit ? custom_made_array_merge(array('inherit' => esc_html__("Inherit", 'custom-made')), $list) : $list;
    	}
    }

    The bold is the line 216.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Renato,

    i have got the same message as you. In my case it was a plugin which was not maintained for quite some time. To figure out which of them it might be, just deactivate them 1 by 1. If you have found it, just try to get there support or find a replacement.

    Thread Starter renato.barone

    (@renatobarone)

    @solocare not sure if it is the right solution, but I’ve deleted and added the same widget. ANd it works now. No idea.

    but it worked for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘count(): Parameter must be an array or an object that implements’ is closed to new replies.