为了账号安全,请及时绑定邮箱和手机立即绑定

将图像添加到内容

将图像添加到内容

PHP
墨色风雨 2023-11-05 15:24:27
我正在使用此代码在WP博客文章的末尾添加标签:    function tags_after_single_post_content($content) {  $posttags = get_the_tags();  if ($posttags) {    $array = [];    foreach($posttags as $tag) {      $array[] = '<a href="/tag/' . $tag->slug . '/">' . $tag->name . '</a>';    }    $content .= 'Tags: ' . implode(', ', $array) . '<br>';  }  return $content;}add_filter( 'the_content', 'tags_after_single_post_content' );但我想插入一个图像而不是“标签:”这个词,这可能吗?
查看完整描述

1 回答

?
慕桂英546537

TA贡献1848条经验 获得超10个赞

尝试以这种方式更改行:

$content .= '<img src="path.jpg"> ' . implode(', ', $array) . '<br>';


查看完整回答
反对 回复 2023-11-05
  • 1 回答
  • 0 关注
  • 60 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信