RhymedCode Forum » Custom Write Panel

Display Custom Field

(4 posts)

  1. DenisCGN
    Member

    How do i display the custom Fields in the LOOP, HELP please, GO !

    Posted 2 years ago #
  2. I use this in my blog to display the content of the custom fields:

    <?php echo get_post_meta($post->ID, \"name-of-custom-field\", true); ?>

    Only replace name-of-custom-field with the name of your custom fields.

    Posted 2 years ago #
  3. Hello, I tried putting the above code into my "single.php" file and I get errors in return:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in .....(../single.php)
    Parse error: syntax error, unexpected T_STRING in ..... (../single.php)

    What I'm trying to do is have it in such a way where a user can submit "featured listings" to the featured listings category.

    My code is as follows:
    <?php echo get_post_meta($post->ID, \"Price\", true); ?>
    <?php echo get_post_meta($post->ID, \"Location\", true); ?>
    <?php echo get_post_meta($post->ID, \"Type\", true); ?>
    <?php echo get_post_meta($post->ID, \"Year Built\", true); ?>
    <?php echo get_post_meta($post->ID, \"Beds\", true); ?>
    <?php echo get_post_meta($post->ID, \"Baths\", true); ?>
    <?php echo get_post_meta($post->ID, \"Square Feet\", true); ?>
    <?php echo get_post_meta($post->ID, \"Acres\", true); ?>
    <?php echo get_post_meta($post->ID, \"Agent\", true); ?>
    <?php echo get_post_meta($post->ID, \"Listing Number\", true); ?>
    <?php echo get_post_meta($post->ID, \"Status\", true); ?>

    Anyhelp would be aprpeciated

    Posted 2 years ago #
  4. Ok, I took the "\" out of there and found it to work. You didn't mention that in your above post for those of us that aren't coding inclined.

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.