I have two chunk of PHP code which is giving me the error:

Warning: Illegal string offset ‘hide_classes’ in
/home/creativi/public_html/wp-content/plugins/authpro/content-builder/models/layouts.php
on line 131

This is the code that the warning is relating to:

Read More
 // mimick widgets mechanism
        $instance = empty($layoutInformation['layoutData']) ? array() : $layoutInformation['layoutData'];

        global $thisWidgetInstanceData;
        $thisWidgetInstanceData = $instance;

        //Get layout styles
        $styles = $this->generateLayoutStyles($instance);
        $styles['hide_classes'] = null; //override hide class in admin editor
        // var_dump($instance);
        ?>

second one :

Warning: Illegal string offset ‘show_delay_attribute’ in
/home/creativi/public_html/wp-content/plugins/authpro/content-builder/models/layouts.php
on line 207
>

related to :

 <div class="row-fluid<?php echo $styles['custom_classes'] ?><?php echo $styles['shadow_class'] ?><?php echo $styles['hide_classes'] ?><?php echo $styles['bg_effect_class'] ?>" id="layout-<?php echo $layoutNumber; ?>" style="<?php echo $styles['layout_style']; ?>" <?php echo $styles['show_delay_attribute']; ?>>

Any help would be greatly appreciated.

Related posts

Leave a Reply

1 comment

  1. Sounds like $styles is a string and you are trying to access it as an array using another string, which won’t work.

    As suggested var_dump $styles or inspect in a debugger to get an idea of what is happening.

    In general, you should check for an array key exists before doing this sort of thing, usually

    echo $array['key'] ? $array['key'] : ''; for echo statements will produce an empty string rather than an error.

    I think the problem is in $this->generateLayoutStyles not returning what you expect.