自动为WordPress文章添加特色图像

将下面的代码添加到当前主题的functions.php中: function wpforce_featured() { global $post; $already_has_thumb = has_post_thumbnail($post->ID); if (!$already_has_thumb) { $attached_image = get_children( "post_parent=$post...

WordPress自动为文章设置特色图像

有的同学不喜欢每次写文章都手动设置一遍特色图像,下面的代码可以帮你解决这个问题:自动将文章中的第一张图片设置为特色图像,如果你手动设置了特色图像,那么会优先选择你手动设置的图像,这样就不会和代码相冲突了。 开启特色图像/缩略图 // 开启特色图并设置默...