How to show Custom Field Template in your post
-
Cool plugin…borderline useless documentation (IMO).
GOOD NEWS: It’s NOT complicated see your cool new metadata. Basically, you have (at least) two options:
- Use a shortcode in your post/page to show your metadata
- Include the WP php call in your template
To use a SHORTCODE in your post/page
- Here is the basic shortcode: [cft] (more options here)
- Put that in your post/page content editor and save/publish
- Go to the Custom Field Template SETTINGS
- IMPORTANT: You must add “output = true” (no quote marks) after each field item that you want to SEE when viewing a page/post
- That is NOT there by default and if you don’t add it, your fields will NOT appear
To display by default in a POST without shortcodes
Note: This requires modifying your template. The example is based on Twenty-Ten template. (Others should be similar, but you’ll have to figure it out yourself.)
You do NOT have to add the “output = true” declarations to use this method.
- Click Appearance > Editor
- Click “look-single.php” in the right-hand file list
- Find this:
- And add the LAST LINE shown below:
`<div class=”entry-content”>
<?php the_content(); ?>
<?php wp_link_pages( array( ‘before’ => ‘<div class=”page-link”>’ . __( ‘Pages:’, ‘twentyten’ ), ‘after’ => ‘</div>’ ) ); ?>
</div><!– .entry-content –>``<div class=”entry-content”>
<?php the_content(); ?>
<?php wp_link_pages( array( ‘before’ => ‘<div class=”page-link”>’ . __( ‘Pages:’, ‘twentyten’ ), ‘after’ => ‘</div>’ ) ); ?>
</div><!– .entry-content –>`
<?php the_meta(); ?>The tweak above will display your Custom Field metadata as the last item(s) on your post before the standard credit line. If you want your metadata to appear somewhere else, you’ll need to experiment moving the call around in your code.
I’m sure there are many, many other ways to get this working. This is A way, not necessarily THE way.
I sincerely hope this helps ease any frustration you have. It worked for me but as usual, your mileage may vary…
- The topic ‘How to show Custom Field Template in your post’ is closed to new replies.