-3

I have this piece of code, which works fine, but one of my clients are getting the

Fatal error: Cannot use string offset as an array

I commented the line that generates the error.

                                <?php 

                                $thumbId1 = get_field('portfolio_images'); //this is the line that generates the error



                                $portfolio_large = $thumbId1[0]['image'];

                                $mafioso_smvideo = get_field('small_video',$post->ID);



                                if($mafioso_smvideo!='') {

                                    echo do_shortcode($mafioso_smvideo);

                                }

                                elseif (!$portfolio_large == ''){ 

                                ?>

                                        <?php

                                            echo '<img src="'.aq_resize( $portfolio_large, 340, 197, true ).'" alt="'.get_the_title().'" class="categ-thumb"/>';

                                        ?>
2

1 Answer 1

0
<?php

if(is_array($thumbId1)){

$portfolio_large = $thumbId1[0]['image'];

}

?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.