关于链接到自定义帖子类型元的问题


Issue on Linking to Custom Post Type Meta

我有一个自定义帖子类型和URL的文本输入元数据。到目前为止,一切对我来说都很好,除非我想将meta返回到按钮中的a href"。这是我的

$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>';

我做错了什么?

删除<?php echo?>。它不需要作为连接字符串

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

也不确定class="之前是什么。。

更新

<button>标记包围链接将使链接不可点击,因为在此上下文中不应使用按钮标记。

将其更改为span而不是

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