我在wordpress网站上对php 7.2有一个问题。我的主机目前运行在php 5.6上,wordpress发送通知后,您需要将php版本升级到7.2,我的主机的Cpu使用率增加到90%!!!这是wordpress的一个巨大缺陷
但现在我要将php升级到7.2,但升级后,除了在产品之间搜索之外,其他一切都很好!当我的用户在wordpress崩溃后使用搜索框试图查找内容并显示此错误时:
The site is experiencing technical difficulties
日志存储了以下错误行:
#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