How do i display the custom Fields in the LOOP, HELP please, GO !
RhymedCode Forum » Custom Write Panel
Display Custom Field
(4 posts)-
Posted 2 years ago #
-
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 # -
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 # -
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 #
Reply
You must log in to post.