Issue on Linking to Custom Post Type Meta

I have a Custom Post Type and a text input metadat for URL. Things works fine for me so far unless when I want to echo the meta to a href"" in button. Here is what I have

$meta = get_post_custom($post->ID);
echo '<button type="button" class="> <a href="'.<?php echo $meta['source'][0];?>.'" target="_blank"> Read More @ News Source</a></button>';

What I am doing wrong?

Solutions

Remove the <?php echo and ?>. Its not required as your concatenating the string

$meta = get_post_custom($post->ID);
echo '<button type="button"> <a href="'.$meta['source'][0].'" target="_blank"> Read More @ News Source</a></button>';

Also not sure what class=" is before..

Update

Surrounding the link with a <button> tag will make the link un-clickable as a button tag should not be used in this context.

Change it to a span instead

$meta = get_post_custom($post->ID);
echo '<span type="button"> <a href="'.$meta['source'][0].'" target="_blank"> Read More @ News Source</a></span>';

Similar questions

Wordpress: Email Linking Issue
I have got quite a weird issue, on my website. On the top right, there is an email address and a phone number. The email address is set in the general settings in the dashboard. The problem, is that when I rollover the email address, only the tip of the "m" in .com becomes active. It is as if there is an invisible object lying above the email addre...
Linking text within textarea of custom meta box
I'm using 'Meta Box Script for WordPress' to create custom meta boxes and everything is working great...except the following: We have a textarea that we want to act, basically as another WP the_content (It's for hidden content that is only shown once a link to show hidden content is clicked). My end-users want to be able to put something like the f...
Wordpress get_post_meta linking to diffrient post type
I want to use post meta as link to different post types. I wrote something like this: Its working fine, but i have problem with two words phrase. On the link im getting space. Can you help me change space for a dash? Do you have any better idea to solve this?
Set Meta Value #1 for Meta Key #1 Only When Meta Value #2 and Meta Key #2 is Present
I need to make updates to my WordPress DataBase but I keep hitting a roadblock when taking into consideration a secondary condition. In very simplistic terms, I have a meta_key = 'flowers' that needs a meta_value = 'roses' to be set only where meta_key = 'month' and meta_value = 'august'. I have not been able to write a successful MySQL query that ...
Custom Post Type order by modified date and custom meta field issue
I'm creating a plugin with some kind of offers that users can publish. User, in his custom administration panel, can managed his own offers. Offers are free and premium. If offer is premium it take place above the free offers in whole list. User can refresh premium offers daily so offer that has been refresh is landing at the top of the list. I fig...
Filter custom post type admin list by custom meta column, where the column is another custom posts meta value
I have 3 custom post types, which are related to each other. Projects, Positions and Feedbacks. 1 Project has many Positions and 1 Position has many Feedbacks. Relations are defined with meta values. Feedbacks post has a meta value, where the value points to position post id, and Positions post has a meta value, where the value points to project po...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.