Support » Plugin: The Events Calendar » How to properly use and display custom field

  • Resolved CommonThreadMerc

    (@commonthreadmerc)


    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”&gt;

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

    =====================================================

    https://wordpress.org/plugins/the-events-calendar/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter CommonThreadMerc

    (@commonthreadmerc)

    Do I perhaps need to register get-field? I see that it is not included in the theme’s list of functions.

    Hi @commonthreadmerc,

    Thanks for getting in touch, and sorry for the issues you’re encountering here! Are you attempting to pull custom field data from WordPress custom fields or using a plugin such as Advanced Custom Fields?

    This article may be helpful if you’re trying to output meta-data from WordPress custom fields.

    Let me know if there’s anything else I can do to assist! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to properly use and display custom field’ is closed to new replies.