Mariton
Mariton

Reputation: 621

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.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.

Suggestions?

Upvotes: 0

Views: 548

Answers (1)

Eimantas Kasperiūnas
Eimantas Kasperiūnas

Reputation: 318

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

Upvotes: 1

Related Questions