自定义字段不显示任何值,只是空返回

我在 wordpress 上使用自定义字段来构建表格。

表代码是这样的:

<?php 
            echo '<table>   <tr>
                <td><b>Personi / Institucioni i Dekoruar</b></td>
                <td><b>Numri i Dekretit</b></td>
                <td><b>Data e Dekretit</b></td>
                <td><b>Medalja</b></td>
            </tr>';

            while (have_posts()) : the_post();          
            $personi_ose_institucioni = get_sub_field('personi_ose_institucioni');  ?>
            <tr><td><a href="<?php the_permalink(); ?> "><?php echo $personi_ose_institucioni.'</td>';

            $numri_i_dekretit = get_sub_field('numri_i_dekretit');
            echo '<td>'.$numri_i_dekretit.'</td>';

            $data_e_dekretit = get_sub_field('data_e_dekretit');
            echo '<td>'.$data_e_dekretit.'</td>';

            $medalja = get_sub_field('medalja');
            echo '<td>'.$medalja.'</td></tr>';
            echo '<tr><td colspan="4"><hr></td></tr>';

            endwhile; ?>
            <tr>
   <?php if (  $wp_query->max_num_pages > 1 ) : ?>
   <td><?php previous_posts_link( __( '<span class="meta-nav">&larr;</span> 
   Previous ', 'twentyten' ) ); ?></td>
  <td></td>
   <td></td>
    <td><?php next_posts_link( __( 'Next<span class="meta-nav">&rarr;</span> 
    ', 'twentyten' ) ); ?></td>
      <?php endif; ?>
            <tr/>
            </table>

问题是这会返回表显示的空值

我在这里做错了什么?

谢谢!!!!

安德鲁舒尔茨

这是一个关于如何访问字段的快速示例。您可以阅读有关如何访问转发器字段的官方文档

if( have_rows('dekorime') ):

    while( have_rows('dekorime') ): the_row(); 

        // vars
        $var1 = get_sub_field('personi_ose_institucioni');
        $var2 = get_sub_field('numri_i_dekretit');
        echo $var1;

    endwhile;
endif;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章