Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Wordpress错误-站点不工作_Php_Wordpress - Fatal编程技术网

PHP Wordpress错误-站点不工作

PHP Wordpress错误-站点不工作,php,wordpress,Php,Wordpress,在将新主题上传到我的wordpress网站时,似乎出现了此错误 错误如下 致命错误:无法在中的写入上下文中使用函数返回值 /home/shutz1/public_html/justserviceofny.com/wp-content/themes/justserviceofny -第16行新站点/front-page.php 如果这有帮助,下面是完整的代码 <?php /** * Home Page template * * @package WordPress * @subp

在将新主题上传到我的wordpress网站时,似乎出现了此错误

错误如下

致命错误:无法在中的写入上下文中使用函数返回值 /home/shutz1/public_html/justserviceofny.com/wp-content/themes/justserviceofny -第16行新站点/front-page.php

如果这有帮助,下面是完整的代码

 <?php

/**
 * Home Page template
 *
 * @package WordPress
 * @subpackage JustServiceOfNewYork
 * @since JustServiceOfNewYork 1.0
 */

get_header();

?>

<div class="home-banner" style="background: url('<?= ot_get_option('home-banner'); ?>');
  <?= !empty(ot_get_option('home-banner-height')) ? 'height:' . ot_get_option('home-banner-height') . 'px;' : ''; ?>"
></div>

<div class="content-wrapper">
  <div class="main-content">
    <?php
    // Start the loop.
    while ( have_posts() ) : the_post();
      get_template_part( 'template-parts/content', 'home' );
    endwhile; // End the loop.
    ?>
  </div><!--.main-content-->

  <?php if ( vct_get_sidebar_class() ) : ?>
    <?php get_sidebar(); ?>
  <?php endif; ?>

</div><!--.content-wrapper-->

<?php get_footer();

这很可能是因为您在函数返回中使用了以下命令:

!empty(ot_get_option('home-banner-height')) ? 'height:' ....
把这行改成

ot_get_option('home-banner-height') ? 'height:'...
只需卸下盖子!空的

替换代码:

<div class="home-banner" style="background: url('<?= ot_get_option('home-banner'); ?>');
<?= !empty(ot_get_option('home-banner-height')) ? 'height:' . ot_get_option('home-banner-height') . 'px;' : ''; ?>">
</div>

因为,你在呼应高度。但作为您的代码,它没有任何响应。

更新代码

<?php $hb = ot_get_option('home-banner'); ?>
<div class="home-banner" style="background: url('<?= echo $hb; ?>');"
<?= $hbh = ot_get_option('home-banner-height');
echo !empty($hbh) ? 'height:' . $hbh . 'px;' : ''; ?>></div>

你的if-else速记有问题。你必须回应它。解释一下你改变了什么,以及为什么它有助于解决问题,这将改善这个答案。
<?php $hb = ot_get_option('home-banner'); ?>
<div class="home-banner" style="background: url('<?= echo $hb; ?>');"
<?= $hbh = ot_get_option('home-banner-height');
echo !empty($hbh) ? 'height:' . $hbh . 'px;' : ''; ?>></div>