本文最后更新于2022年12月8日,部分网盘链接偶尔抽风,下载地址如有失效,请在文章评论区留言反馈。

ripro v2是自带分类缩略图尺寸自定义功能的,但是老油条把它给屏蔽了,今天我们开启分类自定义缩略图尺寸。

开启后效果:

  • 效果参照:
[button class=”demo” href=”http://www.isdoc.cn/template-sc/pic” title=””]今日预设[/button]

开启方法

  • 修改:ripro-v2\ripro-v2\inc\options\taxonomy-options.php将注释去掉。原始如下:
        array(
            'id'      => 'is_no_archive_filter',
            'type'    => 'switcher',
            'title'   => '关闭筛选',
            'label'   => '关闭当前类目下的高级筛选功能',
            'default' => false,
        ),

        // array(
        //     'id'      => 'is_thumb_px',
        //     'type'    => 'switcher',
        //     'title'   => '自定义分类下文章缩略图宽高',
        //     'label'   => '因前台是自适应布局,具体宽高比例前台刷新观察,这里的宽高是图片裁剪真实宽高,在纯分类页面和首页单独分类模块有效',
        //     'default' => false,
        // ),
        // array(
        //     'id'         => 'thumb_px',
        //     'type'       => 'dimensions',
        //     'title'      => '缩略图宽高',
        //     'default'    => array(
        //         'width'  => '300',
        //         'height' => '200',
        //         'unit'   => 'px',
        //     ),
        //     'dependency' => array('is_thumb_px', '==', 'true'),
        // ),
        
        array(
            'id'          => 'archive_single_style',
            'type'        => 'select',
            'title'       => '侧边栏',
            'placeholder' => '',
            'options'     => array(
                'none'  => '无',
                'right' => '右侧',
                'left'  => '左侧',
            ),
            'default'     => _cao('archive_single_style'),
        ),
  • 打开/wp-content/themes/ripro-v2/inc/template-tags.php,搜索:根据模式输出缩略图img 延迟加载html标签,将下边代码:
if (!function_exists('_get_post_media')) {
    function _get_post_media($post = null, $size = 'thumbnail',$video = true) {
        if (empty($post)) {
            global $post;
        }elseif (is_numeric($post)) {
            $post = get_post($post);
        }

        $_size_px = _get_post_thumbnail_size();

        $src = _get_post_thumbnail_url($post, $size);
  • 替换成
if (!function_exists('_get_post_media')) {
    function _get_post_media($post = null, $size = 'thumbnail',$video = true) {
        if (empty($post)) {
            global $post;
        }
        $category = get_the_category($post->ID);
        $catid = $category[0]->term_id;
        if (get_term_meta($catid, 'is_thumb_px', true)) {
            $_size_px = get_term_meta($catid, 'thumb_px', true); //缩略图高度
        }else{
            $_size_px = _get_post_thumbnail_size();
        }

        $src = _get_post_thumbnail_url($post, $size);
  • 更改后台分类多了一个选项:

 

声明:
本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
一、本站文中资源为互联网公开资源,我站仅作收集整理;版权归原作者所有,仅作为个人学习、研究以及欣赏!如有涉及下载请24小时内删除;
二、本站分享的图片、资源、视频等,出镜模特均为成年女性正常写真内容,均不含有淫秽以及色情内容;
三、用户可通过签到得积分来获取所需要的资源,本站VIP为赞助服务,是您喜欢本站而产生的捐赠赞助支持行为,仅为维持服务器及人员的开支与维护