Custom Fields - Create a Post Series


/ Published in: PHP
Save to your folder(s)

This is something that I wished I’d thought of a long time ago – show other posts in the same series using not a plugin but custom fields. All you’ve got to do for this trick to work is create a custom field ‘Series’ with a link to each other post in the series. Each post must be a seperate custom field. Then, use the code below to display all the other posts in the same series!


Copy this code and paste it in your HTML
  1. <?php $series= get_post_meta($post->ID, 'Series', false); ?>
  2. <h3>Also in this series:</h3>
  3. <ul>
  4. <?php foreach($series as $series-post) {
  5. echo '<li>'.$series-post.'</li>';
  6. } ?>
  7. </ul>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.