【发布时间】:2014-06-06 14:04:59
【问题描述】:
我真的是 Wordpress 的新手,并且慢慢地了解它,但我遇到了一个问题,我不知道如何解决它。
我正在使用后端的文本编辑器创建页面,并在其中粘贴 html。一切正常,我可以在functions.php中使用这个函数输出图像(我发现这个sn-p somwhere但不记得在哪里)
// Create the shortcode
function template_url( $atts, $content = null ) {
return '<img src="'. get_template_directory_uri() .'/'. $content .'" alt="" />';
}
// Add as shortcode
add_shortcode("template", "template_url");
我这样称呼它
[template]images/my-image.jpg[/template]
问题是我如何添加一些替代文本并为图像添加一个类
【问题讨论】:
标签: wordpress image function templates