Forums

[resolved] Display value of custom field (but not in undordered list) (3 posts)

  1. databell96
    Member
    Posted 8 months ago #

    Yes, I know about the_meta(). In this case, I don't want to do that. I need to dynamically insert the value of a custom field into an a href link. Something like this:

    <a href="pdf/completions/<?php name_of_custom_field()?>.zip">Custom Field Link</a><br />

    but I can't figure out the proper way to do it. I'm not looking for anything elaborate. There's only one custom field and only one value. No more. So what's the proper PHP code to make this work?

  2. Big Bagel
    Member
    Posted 8 months ago #

    Assuming it's in the loop:

    <a href="pdf/completions/<?php echo get_post_meta( $post->ID, 'the_key', true ); ?>.zip">Custom Field Link</a><br />

  3. databell96
    Member
    Posted 8 months ago #

    Thanks, I finally got it.

Reply

You must log in to post.

About this Topic