Error In Wordpress On All Pages Just Below The Header (Using Theme elumine)

Stack Overflow Asked by Pallav on November 10, 2020

The error is in below lines of the addressed file below (Line 186 & 187):

Website (Live):

Tried restoring an earlier back-up(24 hours back), but that didn’t work also.

Line 186 & 187 from source line:

$collections = get_option('google_typography_collections');
$google_fonts_all = $this->get_fonts();
$import_fonts = array();
if ($collections) {
    foreach ($collections as $collection) {
        $font_family = $collection['font_family'];
        $font_index = array_search($font_family,
                              array_column($google_fonts_all,'family'));//Line 186
        $font_variants = implode(',', $google_fonts_all[$font_index ['variants']); //Line 187
                        'font_family' => $collection['font_family'],
                        'font_variant' => $font_variants,

Error Messages (On All Pages Of Website, these are just few of the lines):

content/themes/elumine/includes/integrations/google-typography/google-typography.php on line 186

Warning: array_search() expects parameter 2 to be array, null given in /home/customer/www/ on line 186

Warning: Illegal string offset 'variants' in /home/customer/www/ on line 187

Warning: implode(): Invalid arguments passed in /home/customer/www/ on line 187

2 Answers

Wisdom Labs has posted a patch to fix the problem.

Answered by Gary Theilman on November 10, 2020

You are getting the errors because on line 186 the $google_fonts_all either does not contain an array with 'family' key or it is not an array. In either case the expression, array_column($google_fonts_all, 'family'), returns empty.

You can extract the later expression into a variable: $family = array_column((array)$google_fonts_all, 'family');

On the line 187, check for the isset( $google_fonts_all[$font_index]['variants'] ) either in a conditional statement or itenary.

Regards Eliasu

Answered by Eliasu on November 10, 2020

Add your own answers!

Related Questions

“Live” data capable alternative for Google Earth KML

1  Asked on February 15, 2021 by christoph1197


React component dispatching generic payload

1  Asked on February 14, 2021 by andyroo


CSS animted gradient

1  Asked on February 14, 2021


Running a value through an array of functions

2  Asked on February 14, 2021 by lars-holdaas


How to revert back to python 2.7?

1  Asked on February 14, 2021 by nikhil-shrivastava


Using same name for attribute and getter

1  Asked on February 13, 2021 by janpeterka


What is the purpose to use className beside functionName using colon(:)

1  Asked on February 13, 2021 by mahedi-hasan-durjoy


Python: access a variable in a module from another file

2  Asked on February 13, 2021 by yeroduk


How to get elements of a sublist in Java

5  Asked on February 13, 2021 by alvira


`SyntaxError` in if-else one-liner

2  Asked on February 13, 2021 by evgeniy-golovin


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir