基本上,我希望在各自主页下的多个子页面上共享相同的特色图像。
有没有插件可以让我这样做,这样他们就可以继承特色图片?
基本上,我希望在各自主页下的多个子页面上共享相同的特色图像。
有没有插件可以让我这样做,这样他们就可以继承特色图片?
您可以通过挂接save\\u post操作并更新特色图像自定义字段轻松完成此操作。在您的功能中。php文件,添加以下代码:
function interit_featured_image( $post_id ) {
// Get Parent ID
$parent_id = wp_get_post_parent_id( $post_id );
// Only proceed if this page has a parent
if ($parent_id != 0) :
// Get Parent Thumbnail
$parent_thumbnail = get_post_meta( $parent_id, \'_thumbnail_id\', true );
// Get Parent Caption Data (for the other plugin)
$parent_caption = get_post_meta( $parent_id, \'_cc_featured_image_caption\', true );
// Set Thumbnail
update_post_meta( $post_id, \'_thumbnail_id\', $parent_thumbnail );
// Set Caption (again, for the other plugin)
update_post_meta( $post_id, \'_cc_featured_image_caption\', $parent_caption );
endif;
}
add_action( \'save_post\', \'interit_featured_image\' );
我有我的blog page here 然而,在我创建的一个网站上,我不太明白在哪里可以找到代码来去除我孩子主题上的图像。我使用的是2010年的代码,我已经设置了自己的博客模板页面,但它不起作用,所以我显然编辑了错误的文件。所以不是循环。php我想要编辑的文件,以便在主博客页面上删除这些图像?<?php /* How to display all other posts. */ ?> <?php else : ?> <div i