使用 WP 函数未显示图像


image not showing using wp functions

我想创建一个"图像"编辑按钮。这是我尝试过的代码,但它输出了一个损坏的图像:

echo "<td><a href='" . 
        admin_url('admin.php?page=get_employee_update&id=' . $value->id) .
        "'><img src='<?php get_template_directory_uri();?>/img/i_edit.png'/>" . 
        "</a></td>";

我也尝试过template_directory功能,但没有用。你们能帮我那个代码有什么问题吗?我是wordpress的初学者,碰巧我在自定义插件中遇到了这种问题。

你在"echo"中使用了php标签。

试试这个:

echo "<td><a href='" . 
    admin_url('admin.php?page=get_employee_update&id=' . $value->id) .
    "'><img src='". get_template_directory_uri() . "/img/i_edit.png'/>" . 
    "</a></td>";