0
我不知道如何将图像放在下面回显的链接中。目前这显示一个链接,但我想让它成为一个可点击的图像,而不是链接。预先感谢您:)用wordpress中的图像替换链接
<div class="back-button">
<?php
$this_page = get_post($id);
$parent_id = $this_page->post_parent;
if ($parent_id) {
$parent = get_page($parent_id);
echo '<a href="'.get_permalink($parent->ID).'" title="">'.get_the_title($parent->ID).'</a>';
}
?>
我想通了!这里的解决方案:
<?php
$this_page = get_post($id);
$parent_id = $this_page->post_parent;
if ($parent_id) {
$parent = get_page($parent_id);
echo '<a href="'.get_permalink($parent->ID).'" title="">'.'<img src="' . get_bloginfo("template_directory") . '/images/close-icon.png" />'.'</a>';
}
?>
不幸的是这没有奏效。我相信你必须使用像:get_bloginfo(“template_directory”)。 '/images/close-icon.png我只是不知道如何将它纳入回波线。 – davidz 2013-03-27 17:37:47