B2缩略图修改

更新于 2021年12月30日 说明书

主题 Modules/Common/Post.php 467 行

    public static function get_post_thumb($post_id = 0){
        if(!$post_id){
            global $post;
            if(!isset($post->ID)) return '';
            $post_id = $post->ID;
        }

        $post_thumbnail_url = get_the_post_thumbnail_url($post_id,'full');
        
        if($post_thumbnail_url){
            return esc_url($post_thumbnail_url);
        }else{
            $post_content = get_post_field('post_content', $post_id);
            return b2_get_first_img($post_content);
        }

        return '';
    }

修改之后

 public static function get_post_thumb($post_id = 0){
        if(!$post_id){
            global $post;
            if(!isset($post->ID)) return '';
            $post_id = $post->ID;
        }

        $post_thumbnail_url = get_the_post_thumbnail_url($post_id,'full');
        
        if($post_thumbnail_url){
            return esc_url($post_thumbnail_url);
        } else if (function_exists('get_wpac_thumbnail')){
	    return get_wpac_thumbnail($post_id);
	} else {
            $post_content = get_post_field('post_content', $post_id);
            return b2_get_first_img($post_content);
        }

        return '';
    }

你可能还喜欢下面这些文章

站点地图插件(wpsitemap)是怎么做到支持百万文章定时任务刷新的站点地图插件(wpsitemap)是怎么做到支持百万文章定时任务刷新的

定时任务每次只会执行全部任务的一小部分,最终就可以自动更新所有的站点地图。比如我们生成的地图中有100页,分别是post-1,post-2,post-3。,那么每次定时任务会依次生成post-1,post-2,post-3。

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

add_action(‘the_post’, ‘wpforce_featured’);

wordpress小说主题imwpclassic 一个古典风格的小说主题wordpress小说主题imwpclassic 一个古典风格的小说主题

功能超强,页面美观的wordpress多本小说主题,一个能给你带来超额收入的主题!主题拥有为小说优化的阅读页面,和普通的页面分开。主题内置sitemap站点地图生成,支持巨量章节生成!