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