开发者

Wordpress functions in wordpress functions and escape characters

开发者 https://www.devze.com 2023-01-09 12:57 出处:网络
I have been trying use the edit_post_link() function to contain an image. All of the quotations and parameters are driving me crazy... How can I get this to work?

I have been trying use the edit_post_link() function to contain an image. All of the quotations and parameters are driving me crazy... How can I get this to work?

This outputs Edit inside the anchor link for editing the post.

<?php edit_post_link(__("**Edit**"), ''); ?>

This outputs the image I want to use.

<?php echo "<img src=\"" ?>
<?php echo bloginfo('templ开发者_JS百科ate_directory')?>
<?php echo "/images/edit.png\" />" ?>

I've tried tons of configurations, this is the latest, but it doesn't work.

<?php edit_post_link(__(" <img src=\" " bloginfo('template_directory') " /images/edit.png\" /> "), ''); ?>


this

<?php edit_post_link('<img src="'.get_bloginfo('template_directory').'/images/edit.png" />', '', ''); ?>

or

<?php edit_post_link(get_bloginfo('template_directory').'/images/edit.png', '<img src="', '" />'); ?>

should work

references:

get_bloginfo(), because only bloginfo() is an echo, get_bloginfo() a return value


Did you try get_edit_post_link() instead? It should return just the URL.

0

精彩评论

暂无评论...
验证码 换一张
取 消