Home Forums Front-end Issues Fields not appearing in the front end


Fields not appearing in the front end

  • Hi all,

    I am using Kadence Theme and I have created a new custom post type to store members’ details. I am using the free ACF version. I have created a single-members.php file and the code for it is below:

    Template Name: Members Layout
    Template Post Type: member
    namespace Kadence;
    if ( ! defined( 'ABSPATH' ) ) {
    kadence()->print_styles( 'kadence-content' );
     * Hook for everything, makes for better elementor theming support.
    do_action( 'kadence_single' );
    <div class="member-meta">
    		<li><strong>Company Name:</strong> <?php the_field('company_name'); ?></li>
    		<li><strong>Company Contact:</strong> <?php the_field('company_contact'); ?></li>
    		<li><strong>Trading Since:</strong> <?php the_field('started_trading'); ?></li>
    		<li><strong>Company PostCode:</strong> <?php the_field('company_postcode'); ?></li>
    		<li><strong>Landline No:</strong> <?php the_field('landline_no'); ?></li>
    		<li><strong>Mobile No:</strong> <?php the_field('mobile_no'); ?></li>
    		<li><strong>Email:</strong> <?php the_field('email'); ?></li>

    This creates an error in the frontend when trying to see the specific custom post. The error is:

    Parse error: syntax error, unexpected ‘<‘, expecting end of file in /home/…single-members.php on line 21

    Line 21 is the line in the code above that starts with “<div class=”member-meta”>”.

    I found the instructions on how to display the custom fields in the Code Examples page of ACF.

    Considering that I’m a bit of a rookie, could anyone please pinpoint what I am doing wrong? Thank you.

  • Just a quick note to say that I used the same code on a non-custom post type (the simple single.php that comes with Kadence theme) and I get the same error.

  • In the case of the code provided you need to close PHP before the HTML portions and open PHP again after

     <div class="member-meta">
  • THANK YOU, THANK YOU, THANK YOU, I’ve been trying to fix this thing for hours.
    Thank you again!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.