Forums

Custom Field Bookmarks (1 post)

  1. jduffell
    Member
    Posted 1 year ago #

    Hi, I've created a template which pulls in link categories, instead of hard coding this I'm hoping that the user can enter a link category id within a custom field and it will display the correct list, avoiding creating multiple templates.

    The code I have is,

    <?php $field = get_post_meta( $post->ID, 'link-category', true ); ?>
    <?php if( $field && '' != $field ) : ?>
    <h2>Additional Reading</h2>
    <?php wp_list_bookmarks(array('title_li'=>__(''),'category'=>'9')); ?>
    <?php endif; ?>

    Instead of hard coding the ID which is 9, I want to replace it with the custom field value which is found under $field, I was wondering how I can insert the $field value in place of the 9.

    If anyone has any ideas it would be good to hear from you, cheers

Topic Closed

This topic has been closed to new replies.

About this Topic