2017-04-27 21:13 阅读 36


I created a new template for a page.

     * Template Name: Sponsors For Homepage

    <?php get_header('sponsor'); ?>

    <div class='divone'>
      <?php the_content(); ?>

    <div class='divtwo'>
    <?php sponser_advertisement(); ?>


And I added a new custom field for the template. Using the Advanced Custom Fields plugin 4.4.8enter image description here

I made sure that the field would show on the correct template: enter image description here

The fields showed up on my template page

enter image description here

For some reason the field value "This is the new field" does not not show up when I preview the page in my browser.

Thanks in advance.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douquanzhan0315 douquanzhan0315 2017-04-27 21:19

    This is the wrong way to display the custom field value.

    If you want to display custom field values in your template, using Advanced custom fields plugin you have to use functions like these:

    <?php the_field('field_name'); ?>


    <?php echo get_field('field_name'); ?>

    you can find full documentation on working with ACF values in here: ACF Documentation

    点赞 评论 复制链接分享