简体   繁体   中英

Custom field now showing up on my new page using Wordpress?

I created a new template for a page.

<?php
    /**
     * Template Name: Sponsors For Homepage
     */
    ?>

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

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

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

    </section>
    </body>
    </html>

And I added a new custom field for the template. Using the Advanced Custom Fields plugin 4.4.8 在此处输入图片说明

I made sure that the field would show on the correct template: 在此处输入图片说明

The fields showed up on my template page

在此处输入图片说明

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.

Suggestions?

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'); ?>

or

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM