Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
简单的Wordpress/PHP查询_Php_Wordpress - Fatal编程技术网

简单的Wordpress/PHP查询

简单的Wordpress/PHP查询,php,wordpress,Php,Wordpress,这是一个相对简单的问题,但我还没有找到解决方案。我希望为每篇文章加载一个自定义的图像大小,我想通过使用副标题(WordPress插件)的标题来实现。我之所以使用副标题而不是“标题”、“类别”或“标签”,是因为它们在网站中都扮演着独立的角色 我需要一个简单的WordPress命令: <?php the_post_thumbnail(); ?> 并将副标题的名称放在其中: <?php if (function_exists('the_subheading')) { the_s

这是一个相对简单的问题,但我还没有找到解决方案。我希望为每篇文章加载一个自定义的图像大小,我想通过使用副标题(WordPress插件)的标题来实现。我之所以使用副标题而不是“标题”、“类别”或“标签”,是因为它们在网站中都扮演着独立的角色

我需要一个简单的WordPress命令:

<?php the_post_thumbnail(); ?>

并将副标题的名称放在其中:

<?php if (function_exists('the_subheading')) { the_subheading(); } ?>

所以看起来是这样的:

<?php the_post_thumbnail('the name of the subheading here'); ?>

非常感谢任何帮助

if (function_exists('the_subheading')) {
$subheading = get_the_subheading($postID);
the_post_thumbnail($subheading);
}
注意:$postID也可以用其他方式编写,这取决于您如何使用post id。或者只需使用$subheading=get_the_subheading()

祝你好运

我很高兴:)只是出于好奇,它是如何工作的?在您的案例中,是否有$postID?谢谢:)