Php Can';无法在WordPress中获取页面内容

Php Can';无法在WordPress中获取页面内容,php,wordpress,Php,Wordpress,当我使用关于我们的页面上的内容()时,我无法从WordPress获取关于我们页面的内容 我得到的只是警告 警告:count():参数必须是 可数的 第284行的D:\xampp\htdocs\megacity\wp includes\post-template.php 我怎么了?请帮我找到这个 我只使用了unyson插件 <?php get_header(); the_content(); global $megacity; ?>

当我使用关于我们的
页面上的
内容()
时,我无法从WordPress获取关于我们页面的内容

我得到的只是警告

警告:count():参数必须是 可数的 第284行的D:\xampp\htdocs\megacity\wp includes\post-template.php

我怎么了?请帮我找到这个

我只使用了unyson插件

    <?php
    get_header();

    the_content();
    global $megacity;
    ?>

    <div class="container">
        <div class="row">        
          <div class="aboutus-section">
           <div class="col-md-4 left-block">
             <h2 class="title block_maintitle">about us</h2>
             <div class="description">
               <p><?php echo $megacity['megacity-about-us-desc']; ?></p>
               <div class="accordion_container">    
                 <?php 
                    // echo "<pre>";
                    // echo $megacity['megacity-about-us-dynamic-func'][0]['title'];
                    // echo "</pre>";

                    foreach( $megacity['megacity-about-us-dynamic-func'] as $key => $value ){
                      ?>
                        <div class="accordion_head"><span class="plusminus">+</span><?php echo $megacity['megacity-about-us-dynamic-func'][$key]['title']; ?></div>
                        <div class="accordion_body" style="display: none;">
                        <p>
                          <?php echo $megacity['megacity-about-us-dynamic-func'][$key]['description']; ?>
                        </p>
                        </div>
                      <?php
                    }
                 ?>
              <!-- <div class="accordion_head"><span class="plusminus">+</span>Health & Safety</div>
                <div class="accordion_body" style="display: none;">
                  <p>
                  Megacity Township is a prosperous wing and journey of unique Devlopers into Construction & Real Estate Business. unique Devlopers has built its own empire and earned a reputation of being successful in various fields of businesses in India as well as Abroad.
                </p>
                </div>

              <div class="accordion_head"><span class="plusminus">+</span>Drywall Technology</div>
                <div class="accordion_body" style="display: none;">
                  <p>
                  Megacity Township is a prosperous wing and journey of unique Devlopers into Construction & Real Estate Business. unique Devlopers has built its own empire and earned a reputation of being successful in various fields of businesses in India as well as Abroad.
                </p>
                </div> -->
       </div>
     </div>
   </div>
   <div class="col-md-7 right-block">
    <div class="vedio-block">
     <img src="<?php echo $megacity['megacity-about-us-img']['url']; ?> " >
   </div>
 </div>
</div>
</div>
</div>

<?php
    get_footer();
 ?>

关于我们

+

" >
这是由于插件或主题在循环外部调用内容()
,其中
$pages=null
。这将导致php 7.2在尝试计数不可计数类型时抛出错误

在您的情况下,必须将
函数的内容()放入主循环中,如下所示:


还包括你的代码。我添加了我的代码。请签出。将你的
内容
放在
中while(have_posts()):the_post();
并检查内容是否显示出来。仍然不起作用-这个错误听起来像是,你的网站上没有页面?你是通过wordpress创建的吗?我使用了内容()密码。请再说一遍。谢谢。
if ( have_posts() ) {
    while ( have_posts() ) { the_post();

        the_content();

    }
}