2014-02-15 55 views
0

我试图自定义帖子并安装了高级自定义字段插件。自定义字段显示在编辑器中,但是当我将所有the_field('fieldname')添加到单个帖子页面时,它会在帖子中显示,但它们全部在一行中。ACF在wordpress中没有正确显示二十四个主题

我使用的主题是二十四。以下是回路是我放置的字段

<?php 
      // Start the Loop. 
      while (have_posts()) : the_post(); 


      get_template_part('content', get_post_format()); 
      the_field('make'); 
      the_field('type'); 
      the_field('year'); 
      the_field('hours'); 
      the_field('location'); 
      the_field('specifications'); 

      // Previous/next post navigation. 
      twentyfourteen_post_nav(); 

      // If comments are open or we have at least one comment, load up the comment template. 
      if (comments_open() || get_comments_number()) { 
          comments_template(); 
         } 
      endwhile; 
    ?> 

它表现出这样的帖子:http://www.hamburgheros.com/2014/02/12/klemm-kr-909-1/

我希望它出来是这样的:

品牌:KLEMM KR 909-1 类型:钻 年份:2012 时间:100 所在地:德国 规格: 多用途/锚钻机

Deutz Engine TCD 2013 L4 2V – 129 KW/175 HP (EPA/TIERIII) 
Crawler type B1/400 mm 3-grouser pads 
Drill mast type 305 
Hammer KD1624 
Different options for double head drilling units and rotary heads 
Different options for clamping and breaking devices 
Remote controlled drilling functions 
Second articulation cylinder 
Winch 
Flushing 1”/1 ½ “ 
Oiler 8 l, 20 bar 
Weight: 13 t 

我试过the_field('field name')\ n;但它不起作用。你怎么让它的名字也出现?

请帮忙,我会非常感激。

铝西弗

回答

0

the_field只返回与该条目相关的数据 - 你必须自己添加标签的一些HTML一起样式的输出,例如;

<?php 
     // Start the Loop. 
     while (have_posts()) : the_post(); 


     get_template_part('content', get_post_format()); 

     ?> 
     <ul> 
      <li>MAKE: <?php the_field('make'); ?></li> 
      <li>TYPE: <?php the_field('type'); ?></li> 
      <li>YEAR: <?php the_field('year'); ?></li> 
      <li>HOURS: <?php the_field('hours'); ?></li> 
      <li>LOCATION: <?php the_field('location'); ?></li> 
      <li>SPEC: <?php the_field('specifications'); ?></li> 
     </ul> 

     // Previous/next post navigation. 
     twentyfourteen_post_nav(); 

     // If comments are open or we have at least one comment, load up the comment template. 
     if (comments_open() || get_comments_number()) { 
         comments_template(); 
        } 
     endwhile; 
?> 
+0

谢谢Snapey,你证实了我的想法。 – user3313684

相关问题