I have an issue with php 7.2 on my wordpress site . My host currently running on php 5.6 and after wordpress send notice that you need to upgrade your php version to 7.2 Cpu usage of my host increased to 90% !!! Thats a huge bug of wordpress
But now i'm gonna upgrade php to 7.2 but after upgrading every thing works fine except searching between products ! When my users using search box trying to find something after wordpress crashes and display this error :
The site is experiencing technical difficulties
The log Stored these lines of error :
#0 /home/censured-site/public_html/wp-includes/template.php(724): require()
#1 /home/censured-site/public_html/wp-includes/template.php(671): load_template('/home/censured...', false)
#2 /home/censured-site/public_html/wp-includes/general-template.php(168): locate_template(Array, true, false)
#3 /home/censured-site/public_html/wp-content/themes/mytheme/search-download.php(89): get_template_part('includes/loop-s...')
#4 /home/censured-site/public_html/wp-includes/template.php(724): require('/home/censured...')
#5 /home/censured-site/public_html/wp-includes/template.php(671): load_template('/home/censured...', false)
#6 /home/censured-site/public_html/wp-includes/general-template.php(168): locate_template(Array, true, false)
#7 /home/censured-site/public_html/wp-content/themes/mytheme/search.php(12): get_template_part('search', 'download')
#8 /home/censured-site/publ in /home/censured-site/public_html/wp-content/themes/mytheme/includes/loop-shop-listings.php on line 24
This is my whole loop-shop-listings.php:
$eddColumn=get_theme_mod('olam_edd_columns');
// var_dump($eddColumn);
switch ($eddColumn) {
case '2 columns':
$colsize=6;
$division=2;
$colclass="col-sm-6";
break;
case '3 columns':
$colsize=4;
$division=3;
$colclass="col-sm-3";
break;
case '4 columns':
$colsize=3;
$division=4;
$colclass="col-sm-6";
break;
default:
$colclass="col-sm-3";
break;
}
if(($wp_query->current_post)%($division)==0){ echo "<div class='row'>"; } ?>
<div class="col-md-<?php echo $colsize; ?> <?php echo $colclass; ?>">
<div class="edd_download_inner">
<div class="thumb">
<?php $videoCode=get_post_meta(get_the_ID(),"download_item_video_id");
$audioCode=get_post_meta(get_the_ID(),"download_item_audio_id");
if(isset($videoCode[0]) && (strlen($videoCode[0])>0) ){
// if(is_numeric($videoCode[0])){
// $videoUrl=wp_get_attachment_url($videoCode[0]);
// }
// else{
$videoUrl=$videoCode[0];
// }
//$videoUrl=wp_get_attachment_url($videoCode[0]);
if (strpos($videoUrl, 'vimeo') !== false) {
echo '<div class="media-thumb vimeovid">'.do_shortcode("[video src='".esc_url($videoUrl)."' muted='1']").'</div>';
} else {
echo '<div class="media-thumb othervid">'.do_shortcode("[video src='".esc_url($videoUrl)."']").'</div>';
}
}
else if(isset($audioCode[0]) && (strlen($audioCode[0])>0) ){
$audioUrl=wp_get_attachment_url($audioCode[0]);
?>
<div class="media-thumb">
<?php echo do_shortcode("[audio src='".$audioUrl."']"); ?>
</div><?php
} ?>
<a href="<?php the_permalink(); ?>"><span><i class="demo-icons icon-link"></i></span>
<?php $square_img = get_post_meta(get_the_ID(),"download_item_square_img");
if (!empty($square_img) && strlen($square_img[0])>0) {
echo '<img src="' . esc_url($square_img[0]) .'" />';
}
elseif ( has_post_thumbnail() ) {
the_post_thumbnail('olam-product-thumb');
}
else {
echo '<img src="' . get_template_directory_uri(). '/img/thumbnail-default.jpg" />';
}
?>
</a>
</div>
<div class="product-details">
<?php $defaultPriceID=edd_get_default_variable_price( get_the_ID() ); ?>
<div class="product-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
<div class="product-price"><?php edd_price(get_the_ID(),true,$defaultPriceID); ?></div>
<?php if ( has_excerpt() ) : // Only show custom excerpts not autoexcerpts ?>
<p class="olam-custom-excerpt"><?php echo get_the_excerpt(); ?></p>
<?php endif; ?>
<div class="details-bottom">
<div class="product-options">
<a href="<?php the_permalink(); ?>" title="<?php esc_attr_e('View','olam'); ?> "><i class="demo-icons icon-search"></i></a>
<?php if(!olam_check_if_added_to_cart(get_the_ID())){
$eddOptionAddtocart=edd_get_option( 'add_to_cart_text' );
$addCartText=(isset($eddOptionAddtocart) && $eddOptionAddtocart != '') ?$eddOptionAddtocart:esc_html__("Add to cart","olam");
if(edd_has_variable_prices(get_the_ID())){
$downloadArray=array('edd_action'=>'add_to_cart','download_id'=>$post->ID,'edd_options[price_id]'=>$defaultPriceID);
}
else{
$downloadArray=array('edd_action'=>'add_to_cart','download_id'=>$post->ID);
}
?>
<a href="<?php echo esc_url(add_query_arg($downloadArray,edd_get_checkout_uri())); ?>" title="<?php esc_attr_e('Buy Now','olam'); ?>"><i class="demo-icons icon-download"></i></a>
<?php
$purchase_link_args = array(
'download_id' => get_the_ID(),
'price' => false,
'direct' => false,
'style' => 'plain',
'class' => 'demo-icons icon-cart cart-icon-btn',
'text' => '',
);
$purchase_link_args = apply_filters( 'edd_rp_purchase_link_args', $purchase_link_args );
echo edd_get_purchase_link( $purchase_link_args );
} else { ?>
<a class="cart-added" href="<?php echo edd_get_checkout_uri(); ?>" title="<?php esc_attr_e('Checkout','olam'); ?> "><i class="fa fa-check"></i></a>
<?php } ?>
</div>
<?php $olamct=get_theme_mod('olam_show_cats');
if(isset($olamct)&& $olamct==1 ){
$cat = wp_get_post_terms(get_the_ID(),'download_category');
if(count($cat)>0){
$mlink = get_term_link($cat[0]->slug,'download_category');
?><div class="product-author"><a href="<?php echo $mlink; ?>"><?php echo($cat[0]->name); ?></a></div><?php
} }
else{
?> <div class="product-author"><a href="<?php echo esc_url(add_query_arg( 'author_downloads', 'true', get_author_posts_url( get_the_author_meta('ID')) )); ?>"><?php esc_html_e("By","olam"); ?>: <?php the_author(); ?></a></div><?php
}
?>
</div>
</div>
</div>
</div>
<?php if(($wp_query->current_post+1)%($division)==0){ echo "</div>"; }
else if(($wp_query->current_post+1)==$wp_query->post_count ){ echo "</div>"; }```
please help me . Thanks
includes/loop-shop-listings.php
has a problem on line 24 but it's not clear what the problem is without the error message