2016-03-15 38 views
0

對於一些未知的原因,我不能循環出中繼場在我的面前,page.php文件。我將聖人主題作爲基礎。WordPress的聖人模板不能循環了ACF中繼場

這是我base.php是什麼樣子:

<?php 

use Roots\Sage\Setup; 
use Roots\Sage\Wrapper; 

?> 

<!doctype html> 
<html <?php language_attributes(); ?>> 
    <?php get_template_part('templates/head'); ?> 
    <body <?php body_class(); ?> style="background-color: rgba(0,0,0,1);"> 
    <!--[if IE]> 
     <div class="alert alert-warning"> 
     <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage'); ?> 
     </div> 
    <![endif]--> 

     <?php include Wrapper\template_path(); ?> 

    <?php 
     do_action('get_footer'); 
     get_template_part('templates/footer'); 
     wp_footer(); 
    ?> 
    </body> 
</html> 

這是我的前page.php文件的樣子:

<div class="slider-circles"> 
    <?php if(have_rows('field_56e7d8bebb545')): ?> 
    <?php while (have_rows('field_56e7d8bebb545')) : the_row(); ?> 
     <p id="slide1" data-bgimage="<?php the_sub_field('field_56e7d8cebb546'); ?>" class="transparent-circle slick-active"></p> 
    <?php endwhile; ?> 
    <?php endif; ?> 
</div> 

有趣的是,我已經這樣做了完全一樣的幾天前在其他項目上的事情,一切正常。我絕對不知道爲什麼它現在無法正常工作:/

回答

1

對前page.php文件WordPress默認循環適用於分配到「設置>閱讀 - >文章頁面」靜態頁面的文章內容。

嘗試傾銷中繼字段的值用

<?php die(var_dump(get_field('field_56e7d8bebb545'))); ?>

如果您沒有看到該轉發器領域的任何值(和喜歡的東西the_title()不工作),然後循環可能沒有執行。

檢查是否已設置了「頭版顯示」爲「靜態頁面」,按照這裏的說明:https://codex.wordpress.org/Creating_a_Static_Front_Page

+0

我已經將它們在我的可溼性粉劑管理員。你的代碼似乎也沒有工作。 –

+0

添加: 什麼輸出? –

+0

我已經試過各種可能的後續代碼var_dump,沒有工作,甚至不是一個簡單的the_title()轉儲 –