Calling a custom field inside of an echo?
-
Let me start at the beginning. Forgive me, as I am not well versed in PHP, and tend to take more of a stumbling, smash-and-grab approach to the language.
Here’s what I’m trying to do:
I have a conditional statement that displays buttons to download a file using an echo, provided a post from a certain category is being shown. What I need to do is have the href to one of the buttons be taken from a custom field (in this case, “direct_download_link”) from that post. Here’s the code I’m trying to use to accomplish this:
<?php if ( in_category( 'Episodes' )) { echo '<a href="<?php echo get_post_meta($post->ID, 'direct_download_link', true); ?>"><img src="/images/download-button_01.png"></a><img src="/images/download-button_02.png"><br><br>'; } ?>
Of course, this isn’t working, because the php inside of the echo isn’t getting parsed, it’s just printing to the browser.
The page in question is here: https://anchor-consulting.com/dev/bionic/?p=559
Can anyone help me, or offer a better suggestion for accomplishing what I am trying to do?
Thank you very much
- The topic ‘Calling a custom field inside of an echo?’ is closed to new replies.