I have a quick question about upgrading my theme file to PHP 7.1. I know it's easy to do, but I don't understand PHP.
It is currently in an old compatibility of 5.3 and this is the only error in 2 parts of my theme: "ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and prohibited since PHP 5.4."
I would ask my theme developer, but last time they did something they deleted all of my custom CSS code. Very awful support from them and I can't trust them anymore.
Both problem lines use this code setup_postdata( $GLOBALS['post'] =& $post_object );
THEME FILE #1:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( $upsells ) : ?>
<div class="ps-section pb-50">
<div class="ps-container">
<div class="ps-section__header text-center">
<h2 class="ps-section__title"><?php esc_html_e('You may also like…', 'xuper');?></h2>
</div>
<div class="ps-section__content">
<div class="ps-slider--center owl-slider products" data-owl-auto="true" data-owl-loop="true" data-owl-speed="5000" data-owl-gap="30" data-owl-nav="true" data-owl-dots="false" data-owl-item="4" data-owl-item-xs="1" data-owl-item-sm="2" data-owl-item-md="3" data-owl-item-lg="4" data-owl-duration="1000" data-owl-mousedrag="on" data-owl-nav-left="<i class='ps-icon-arrow-left'></i>" data-owl-nav-right="<i class='ps-icon-arrow-right'></i>">
<?php foreach ( $upsells as $upsell ) : ?>
<?php
$post_object = get_post( $upsell->get_id() );
setup_postdata( $GLOBALS['post'] =& $post_object );
wc_get_template_part( 'content', 'product' ); ?>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
`
`
<?php
$post_object = get_post( $related_product->get_id() );
`setup_postdata( $GLOBALS['post'] =& $post_object );
wc_get_template_part( 'content', 'product' ); ?>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
wp_reset_postdata();
Thanks for any help, I really appreciate it!