• Resolved lippi

    (@lippi)


    Hello, during personalisation in admin panel a warning occurs:

    Warning: Invalid argument supplied for foreach() in /home/users/default/public_html/wp-content/themes/botiga/inc/customizer/controls/typography/class_botiga_typography.php on line 128

    Theme: Botiga 1.0.6
    Wordpress: 5.8.1
    PHP: 7.4

    Clean installation with demo content (Beauty).

    What should I do to get rid of it?
    I don’t want to disable warnings in PHP.

    • This topic was modified 3 years, 1 month ago by lippi.
    • This topic was modified 3 years, 1 month ago by lippi.
    • This topic was modified 3 years, 1 month ago by lippi.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter lippi

    (@lippi)

    I’ve temporarily solved problem. Warning occurs if website doesn’t use Google Fonts and get_font_index function receives empty array.

    
    /*** Find the index of the saved font in our multidimensional array of Google Fonts ***/
    public function get_font_index( $haystack, $needle ) {
    	if ( isset( $haystack ) && !empty( $haystack )) { -- fix
    		foreach( $haystack as $key => $value ) {
    			if( $value->family == $needle ) {
    				return $key;
    			}
    		}
    	}
    	return false;
    }
    
    • This reply was modified 3 years, 1 month ago by lippi.
    • This reply was modified 3 years, 1 month ago by lippi.

    Hi @lippi,

    I am sorry to hear the trouble. I am happy to help out.

    That error is usually related to wp_remote_get not performs properly on your server. Please check with your web hosting support and ensure cURL and wget modules have been enabled on your server.

    Regards,
    Kharis

    Thread Starter lippi

    (@lippi)

    I’ve noticed that I don’t have “Font family” option in Typography. As You mentioned wp_remote_get doesn’t work. I need to fix it. Thank You.

    • This reply was modified 3 years, 1 month ago by lippi.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Typography warning’ is closed to new replies.