Parse error: syntax error, unexpected (in WP plugin) PHP

Parse error: syntax error, unexpected (in WP plugin) PHP

我正在尝试添加按钮阅读更多,但是在DIV中添加按钮代码时出现错误,插件无法运行。告诉我错误在哪里?

Parse error: syntax error, unexpected 'href' (T_STRING) in /****/public_html/wp-content/plugins/page-list/page-list.php on line 351

/*BEFORE */
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.';                  

/*AFTER */
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.<p><a href="'.$link.'" title="'.esc_attr($page- rel="nofollow">post_title).'">Read More</a></p>'</div>';

谢谢!

您的代码有几处错误。 /*BEFORE */ 代码因最后的 ' 而损坏,但您想让 /*AFTER */ 代码正常工作,所以让我们专注于此:

$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.<p>
// missing a ' here: --------------------------------------------------^^

<a href="'.$link.'" title="'.esc_attr($page- rel="nofollow">post_title).'">Read
// this doesn't belong here: ---------------^^^^^^^^^^^^^^^

 More</a></p>'</div>';
// Why is ---^ that ' there?

我想你要找的是这个:

$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'<p><a href="'.$link.'" title="'.esc_attr($page->post_title).'" rel="nofollow">Read More</a></p></div>';

您有几个错误。
"'
的使用有误 当您调用 esc_attr () 函数时,您传递的参数无效。