WordPress.org

Support

Support » Plugins and Hacks » How to show Custom Field Template in your post

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:

    1. Use a shortcode in your post/page to show your metadata
    2. Include the WP php call in your template

    To use a SHORTCODE in your post/page

    1. Here is the basic shortcode: [cft] (more options here)
    2. Put that in your post/page content editor and save/publish
    3. Go to the Custom Field Template SETTINGS
    4. IMPORTANT: You must add “output = true” (no quote marks) after each field item that you want to SEE when viewing a page/post
    5. 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.

    1. Click Appearance > Editor
    2. Click “look-single.php” in the right-hand file list
    3. Find this:
    4. `<div class=”entry-content”>
      <?php the_content(); ?>
      <?php wp_link_pages( array( ‘before’ => ‘<div class=”page-link”>’ . __( ‘Pages:’, ‘twentyten’ ), ‘after’ => ‘</div>’ ) ); ?>
      </div><!– .entry-content –>`

    5. And add the LAST LINE shown below:
    6. `<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…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to show Custom Field Template in your post’ is closed to new replies.