PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Post-Meta-Key

  1. Chineseand
    Member

    I have a form to create posts, with an added <?php the_meta(); ?> line in the loop.php file, which outputs the custom post fields.

    Two questions:
    1) I see in some of the other posts that there is a way to put the content of those custom fields in the body of the post - can you point me to a breakdown of how that works?

    2) And more important at the moment - Can the order of the post-meta-key outputs be controlled if I just list them above the post body? My issue with this at the moment is that on one of my posts I get this output at the moment for some test info I entered :

    <ul class='post-meta'>
    <li><span class='post-meta-key'>Phone Number:</span> (232)215-1215</li>
    <li><span class='post-meta-key'>Province / State:</span> Nova Scotia</li>
    <li><span class='post-meta-key'>Location:</span> Sydney Mines</li>
    <li><span class='post-meta-key'>Reason Code:</span> Install Help</li>
    <li><span class='post-meta-key'>RMA:</span> </li>
    </ul>

    but like this for another sample post :

    <ul class='post-meta'>
    <li><span class='post-meta-key'>Location:</span> loco</li>
    <li><span class='post-meta-key'>Phone Number:</span> (242)511-1144</li>
    <li><span class='post-meta-key'>Reason Code:</span> Install Help</li>
    <li><span class='post-meta-key'>Province / State:</span> Alaska</li>
    <li><span class='post-meta-key'>RMA:</span> </li>
    </ul>

    You'll notice that the order of the output of the fields is different even though the form used was the same. I'm thinking this has to do with capitalization etc on the entry side?? I can't control that though, so I want to be able to control the order of the output. Any help with that would be much appreciated.

    Thanks!

    Posted 13 years ago on Thursday June 2, 2011 | Permalink
  2. You can use the Post Body content template functionality to customize how the Post Body content is formatted when the post is created. Basic example: http://grab.by/agUr

    In regards to the order of the post meta, where is the code you've shared being output?

    Posted 13 years ago on Thursday June 2, 2011 | Permalink
  3. Chineseand
    Member

    Oh, I can call the fields right in the template when I make it?!? Cool, I'll have to try that out!

    Re: The meta as is: It's being output into a post page like so:

    <?php while ( have_posts() ) : the_post(); ?>
    
    	<div class="postwrapper">
    		<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'Forum' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    			<?php the_meta(); ?>
    
    <?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>

    Is that what you mean?

    Thanks!

    Posted 13 years ago on Friday June 3, 2011 | Permalink
  4. More so I was curious if the code you shared was being output by Gravity Forms or by your theme or custom code? Gravity Forms does not handle the output of custom post meta on the front end; only capturing it via a Gravity Form.

    Posted 13 years ago on Friday June 3, 2011 | Permalink