正在尝试在Functions中创建短代码。php显示特色帖子。。
我所拥有的一切都很好,只是我无法获得背景图像来显示帖子的特色图像。。。
echo$featured\\u post\\u url显示正确的地址,但我无法将其显示为div的背景图像。。。
也许我盯着电脑屏幕看得太久了。。。有人能告诉我我在这里错过了什么吗?
function propertunity_featured_post() {
$featured_post_id = 2860;
$featured_post = get_post($featured_post_id);
$featured_post_url = get_permalink($featured_post_id);
$featured_post_image_url = wp_get_attachment_url(
get_post_thumbnail_id($featured_post_id, \'thumbnail\') );
echo "
<div class=\'card\'>
<div class=\'card-header\' style=\'background-color: #f8f8fc; overflow: hidden;\'>
<a href=\'" . $featured_post_url . "\'>
<div class=\'card__image\' style=\'background-image: url(\' " . $featured_post_image_url . " \');\'></div>
</a>
</div>
</div>";