答案 0 :(得分:0)
正如文档https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/中所述,它返回标记,而不是网址。 要获取网址,请执行
$image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' );
转到doc https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/了解更多信息;)
答案 1 :(得分:0)
我认为你的$catimg
没有返回任何内容或空字符串
我已经尝试过这个代码在php中使用静态图像,它的工作正常,所以你的字符串插值是正确的。请检查您的$catimg
变量
<?php
//This one gets the image from the first product in the product category category:
$catimg = 'https://pbs.twimg.com/profile_images/718314968102367232/ypY1GPCQ_400x400.jpg';
$variable1 = "Rajesh";
$variable = "Text";
//This code contains custom text that also reads info from various variables, including the `$catimg` variable:
$cat_art1 = '<h1>'.$variable1.' This is some text that will be outputted to my site.</h1>
Here i want to screen the image <img src="' . $catimg . '" alt="alt">
Some more text and another '.$variable.' to end the line';
echo $cat_art1;
?>
答案 2 :(得分:0)
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN: {
// Do something when volume down button is clicked
return true;
}
case KeyEvent.KEYCODE_VOLUME_UP: {
// Do something when volume up button is clicked
return true;
}
}
return super.onKeyDown(keyCode, event);
}