• Resolved parthatel

    (@parthatel)


    Because I’m using TDO Mini Forms (and they don’t have an excerpt widget), I need to convert the excerpt for the post into a custom field. How do I do this, and how do I implement it?

    I know I can just create a new key called excerpt and then add the text into the value, but I don’t know how to put that into my template. What code do I use?

    I’ve already read https://codex.www.ads-software.com/Using_Custom_Fields but still don’t get it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • In the content loop do something like this:

    <?php $key_name="your custom field name"; $key_value = get_post_meta($post->ID, $key_name, true); ?>
    <?php echo $key_value; ?>

    if your custom field is called excerpt it would look something like this:

    <?php while (have_posts()) : the_post(); ?>
      <?php $key_name="excerpt"; $key_value = get_post_meta($post->ID, $key_name, true); ?>
      <p>
         <?php echo $key_value; ?>
      </p>
    <?php endwhile; ?>
    Thread Starter parthatel

    (@parthatel)

    Thanks. This is really helpful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to make the excerpt into a custom key? or Using Custom Fields’ is closed to new replies.