[英]Bulk add featured image to existing Wordpress posts
I have cca 4500 posts in my Wordpress backend. 我的Wordpress后端有cca 4500帖子。 Some posts doesn't have featured image. 有些帖子没有精选图片。 I was wondering is there any solution to bulk add featured image (placeholder if there is no "real" image)? 我想知道是否有任何解决方案批量添加精选图像(占位符,如果没有“真实”图像)? I'm talking about backend, I now that I can do on front end but need way to add featured image in the backend if featured image is empty. 我在谈论后端,我现在可以在前端做,但如果特色图像为空,则需要在后端添加特色图像。 Can anybody help me with this? 任何人都可以帮我吗?
You can do this using 3 ways. 你可以用3种方法做到这一点。
https://wordpress.org/plugins/default-featured-image/ https://wordpress.org/plugins/default-featured-image/
check below code for front-end 检查以下代码的前端
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/default-image.jpg" alt="<?php the_title(); ?>" />
<?php } ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.