How to properly use and display custom field
-
I am trying to use a custom field in my calendar from The-Events-Calendar. The custom field selected from the drop-down list is ‘instructors’ and I used a value of ‘Tom Jones’, but the field data does not display on the calendar event. Then I updated page.php and later content.php with code to make it display, and after each attempt I tested and got an error displayed on each page…and it still does not display the value for instructors.
The code that I used in each area was the same:
<?php echo get-field(‘instructors’); ?>
and it resulted in the following error. What am I doing wrong?Fatal error: Call to undefined function field() in D:\Hosting\13958279\html\wp-content\themes\adelle\page.php on line 18
If I remove the coding that I added, there is no error. Here is the full text of page.php up to and including the line of code that I added:
=====================================================
<?php get_header(); ?><main class=”section”>
<?php if( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article class=”article article-page” itemscope itemtype=”http://schema.org/CreativeWork”>
<header class=”post-header”>
<h2 class=”post-title entry-title” itemprop=”headline”><?php the_title(); ?></h2>
</header><article class=”post-content entry-content” itemprop=”text”>
<?php the_content(); ?>
<?php echo get-field(‘instructors’); ?>
=====================================================
- The topic ‘How to properly use and display custom field’ is closed to new replies.