How do I display custom fields?

I'm trying to add custom fields to my directory listings, and I'm not able to get the fields to display.

When creating the listings, I went down to the Custom Fields section, the "Add New Custom Fields" subsection, added the fields I wanted (phone number, address, website), assigned values to those fields, and clicked the "Add Custom Field" button. Those fields are now shown above the "Add New Custom Fields" subsection, so I'm guessing I did that correctly.

I've been reading about custom fields, and I know I need to add a template tag to the loop, and that's where I get confused. Somewhere, I read that in Directory, I would need to alter the single.php file, so I went to my cPanel / directory / themes / default, and opened single.php. I've inserted:
<?php the_meta(); ?>
into the file, above:
</div><!-- end #content -->
and that hasn't worked. Is there somewhere else that I'm supposed to add the tag, or am I even using it correctly?

Is there something I'm supposed to write in the text of the listings to tell them to display the custom fields?

Thanks for your help.

  • Timothy
    • Chief Pigeon

    Hey there.

    Custom fields I believe should show up in Single.php by default. Single.php is the file user to show a single article.

    Which theme are you using because not all themes are the same, so there could be something in the theme preventing this from working.

    If you want to show custom fields within an archive page then you can use the custom embed code. So for example to show them as a block of custom fields you would use this:

    <?php echo do_shortcode('[custom_fields_block]'); ?>

    If you want to show them individually then it would be something like this:

    <?php echo do_shortcode('[ct id=&quot;_ct_text_50b8ac89a4276&quot; property=&quot;title | description | value&quot;]'); ?>

    I've included a screenshot of where you find the code.

    It would need to be within the loop if done within the code.

    Take care.

  • joseph_gallegos
    • WPMU DEV Initiate

    Hi Timothy,
    Thank you for taking the time to write the custom single file for me. I want to make sure I'm using it correctly.

    I replaced the single.php file you wrote with the ones in both the Directory folder and the BP Business folder. Specifically:

    This didn't have any effect on the displaying of the custom fields.
    There is also a single-listing.php file at:

    Should this also be changed?

    Are there short codes I need to put in the main section of my listings in order to get the custom fields to display? Nothing I've read suggests that, but I want to make sure I'm not overlooking anything.

    I created my custom fields on the page where I create each listing, and it's saved the fields I've created for subsequent listings (e.g. I don't need to create the "address" custom field each time I create a new listing). Should I be creating the custom fields in the CustomPress area instead?

    Thanks again for your help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.