🎅挂件馆🌟铭牌馆✨️靓标库🧚‍♂️名人堂🦄宝可梦🍎水果机🥊猜拳🏧黑市🏧银行💹抽奖
   🎁
返回列表 发布新帖
查看: 233|回复: 0

[代码技巧] 热门 教程笔记 子比主题 子比主题 – 文章主内容详细信息样式

[复制链接]
飞流 00001
起源之星
任务·年会员
累计签到LV.3
摩羯座
+1
社区贡献
346 216 24292
等级头衔
Icon组别 : 管理员
Icon等级 :

积分成就
   钻石 : 175 颗
   贡献 : 14431 点
   金币 : 4 枚
Icon在线时间 : 1952 小时
Icon注册时间 : 2024-11-22
Icon最后登录 : 2026-8-16
送礼物:3 收礼物:1
FLLTCN 实名认证 特邀大神 诚信商家 信誉担保 精华作者+ 官方团队 vip vip-year 发表于 2025-10-10 16:51:10 | 查看全部 |阅读模式 浙江金华

交易无需等待,成交就是现在,全面资源整合网络大咖云集,让你轻松玩转互联网!

您需要 登录 才可以下载或查看,没有账号?立即注册

×
今天给大家分享是一个子比主题文章主内容上方加一个详细信息样式,这款样式我觉得还是不错的,用子比做软件站的人挺多的,所以今天就给大家免费分享一下这个文章主内容详细信息样式,古腾堡可以自定义信息,喜欢的自行部署吧!

效果


tengfei_down - 2025-10-10T164528.928.webp
tengfei_down - 2025-10-10T164530.711.webp

后台配置


tengfei_down - 2025-10-10T164532.463.webp

更新日志



  • # 修复下载按钮自动跳转子比的付费阅读、付费下载等等功能
  • # 修复没有开启付费阅读、付费下载等不显示文章顶部显示下载


代码部署


这个原来版本的代码我将保留,在下面我将发新的一个版本~

原版代码
一共有两个部分,跟着我的教程走不会有问题,话不多说直接开始!

func代码
定位:/wp-content/themes/zibll/func.php文件,没有这个文件自己创建一个,记得加上php头,要不然会报错,然后将下面的代码放到里面,其实下面的代码是放到metabox-options.php文件里面的,但是方便就放到func.php里面吧
  1. if (class_exists('CSF')) {
  2.     CSF::createMetabox('zib_post_extra', array(
  3.         'title'      => '文章额外信息',
  4.         'post_type'  => array('post'),
  5.         'context'    => 'advanced',
  6.         'data_type'  => 'unserialize',
  7.     ));

  8.     $fields = array();

  9.     $fields[] = array(
  10.         'id'      => 'zib_platform',
  11.         'type'    => 'select',
  12.         'title'   => '平台',
  13.         'options' => array(
  14.             'android' => 'Android',
  15.             'ios'     => 'iOS',
  16.             'windows' => 'Windows',
  17.             'mac'     => 'Mac',
  18.             'linux'   => 'Linux',
  19.             'other'   => '其他',
  20.         ),
  21.         'default' => 'android'
  22.     );

  23.     $fields[] = array(
  24.         'id'    => 'zib_size',
  25.         'type'  => 'text',
  26.         'title' => '文件大小',
  27.         'desc'  => '如:21.3M'
  28.     );

  29.     $fields[] = array(
  30.         'id'    => 'zib_version',
  31.         'type'  => 'text',
  32.         'title' => '文件版本',
  33.         'desc'  => '如:v3.3.7'
  34.     );

  35.     $fields[] = array(
  36.         'id'    => 'zib_language',
  37.         'type'  => 'text',
  38.         'title' => '语言',
  39.         'desc'  => '如:简体中文'
  40.     );

  41.     $fields[] = array(
  42.         'id'      => 'zib_license_type',
  43.         'type'    => 'select',
  44.         'title'   => '授权类型',
  45.         'options' => array(
  46.             'free'      => '免费版',
  47.             'modified'  => '修改版',
  48.             'official'  => '官方版',
  49.             'other'     => '其他',
  50.         ),
  51.         'default' => 'official'
  52.     );

  53.     $fields[] = array(
  54.         'id'      => 'zib_recommend_star',
  55.         'type'    => 'select',
  56.         'title'   => '推荐星级',
  57.         'options' => array(
  58.             '1' => '★☆☆☆☆',
  59.             '2' => '★★☆☆☆',
  60.             '3' => '★★★☆☆',
  61.             '4' => '★★★★☆',
  62.             '5' => '★★★★★',
  63.         ),
  64.         'default' => '5'
  65.     );

  66.     CSF::createSection('zib_post_extra', array('fields' => $fields));
  67. }
  68. add_action('admin_head', function() {
  69.     echo '<style>
  70.     .csf-metabox .csf-field { margin-bottom: 6px !important; }
  71.     .csf-metabox .csf-field .csf-title { margin-bottom: 2px !important; }
  72.     .csf-metabox .csf-field + .csf-field { border-top: none !important; }
  73.     </style>';
  74. });
复制代码

single代码
定位:/wp-content/themes/ZibTF/inc/functions/zib-single.php,那么这个文件就是子比的页面的文件,然后我们找到下面的函数,大约在157行,如下图
tengfei_down - 2025-10-10T164808.701.webp
把这整个函数全部替换成下面的代码,因为我改了里面的代码,你直接替换就行,记得备份一下,方便后面好更新,如果有子主题的话当我没说!
  1. function zib_get_breadcrumbs() {
  2.     static $zib_get_breadcrumbs = null;
  3.     if ($zib_get_breadcrumbs !== null) {
  4.         return $zib_get_breadcrumbs;
  5.     }

  6.     if (!is_single() || !_pz('breadcrumbs_single_s', true)) {
  7.         $zib_get_breadcrumbs = '';
  8.         return $zib_get_breadcrumbs;
  9.     }

  10.     $categorys = get_the_category();
  11.     if ($categorys) {
  12.         $category = $categorys[0];
  13.         $lin = '<ul class="breadcrumb">
  14.             <li><a href="' . get_bloginfo('url') . '"><i class="fa fa-map-marker"></i> ' . (!_pz('breadcrumbs_home_text', true) ? get_bloginfo('name') : '首页') . '</a></li><li>
  15.             ' . get_category_parents($category->term_id, true, ' </li><li> ') . (!_pz('breadcrumbs_single_text', true) ? get_the_title() : '正文') . '</li></ul>';

  16.         $post = get_post();
  17.         $size = 'full';
  18.         $img_url = wp_cache_get($post->ID, 'post_thumbnail_url_' . $size, true);

  19.         if (false === $img_url) {
  20.             $img_url = '';

  21.             $post_thumbnail_id = get_post_thumbnail_id($post->ID);
  22.             if ($post_thumbnail_id) {
  23.                 $image_src = zib_get_attachment_image_src($post_thumbnail_id, $size);
  24.                 $img_url   = isset($image_src[0]) ? $image_src[0] : '';
  25.             }

  26.             if (!$img_url) {
  27.                 $img_url = zib_get_post_meta($post->ID, 'thumbnail_url', true);
  28.             }

  29.             if (!$img_url && _pz('thumb_postfirstimg_s', true)) {
  30.                 $post_img_urls = zib_get_post_img_urls($post);
  31.                 $img_url       = isset($post_img_urls[0]) ? $post_img_urls[0] : '';
  32.                 if ($img_url && $size && 'full' !== $size) {
  33.                     $img_id = zib_get_image_id($img_url);
  34.                     if ($img_id) {
  35.                         $img = wp_get_attachment_image_src($img_id, $size);
  36.                         if (isset($img[0])) {
  37.                             $img_url = $img[0];
  38.                         }
  39.                     }
  40.                 }
  41.             }

  42.             wp_cache_set($post->ID, $img_url, 'post_thumbnail_url_' . $size, 3600);
  43.         }

  44.         if (!$img_url) {
  45.             $img_url = '默认封面图片链接';
  46.         }

  47.         $cat = get_the_category();
  48.         $cat_links = '';
  49.         $category_colors = ['blue', 'green', 'yellow', 'red', 'purple'];
  50.         foreach ($cat as $index => $category) {
  51.             $color = $category_colors[$index % count($category_colors)];
  52.             $cat_links .= '<a class="but ml6 radius c-' . $color . '" href="' . get_category_link($category->term_id) . '" title="查看此分类更多文章"><i class="fa fa-folder-open-o"></i>' . $category->name . '</a> ';
  53.         }

  54.         $tags = get_the_tags();
  55.         $tag_links = '';
  56.         if ($tags) {
  57.             foreach ($tags as $tag) {
  58.                 $tag_links .= '<a class="but ml6 radius" title="查看此标签更多文章" href="' . get_tag_link($tag->term_id) . '">#' . $tag->name . '</a>';
  59.             }
  60.         }

  61.         $platform = get_post_meta($post->ID, 'zib_platform', true);
  62.         $platform_map = [
  63.             'android' => 'Android',
  64.             'ios' => 'iOS',
  65.             'windows' => 'Windows',
  66.             'mac' => 'Mac',
  67.             'linux' => 'Linux',
  68.             'other' => '其他'
  69.         ];
  70.         $platform_text = isset($platform_map[$platform]) ? $platform_map[$platform] : 'Android';

  71.         $size_text = get_post_meta($post->ID, 'zib_size', true);
  72.         $size_text = $size_text ? $size_text : '未知';

  73.         $version_text = get_post_meta($post->ID, 'zib_version', true);
  74.         $version_text = $version_text ? $version_text : '未知';

  75.         $license_type = get_post_meta($post->ID, 'zib_license_type', true);
  76.         $license_type_text = '官方版'; // 默认
  77.         switch ($license_type) {
  78.             case 'free': $license_type_text = '免费版'; break;
  79.             case 'modified': $license_type_text = '修改版'; break;
  80.             case 'official': $license_type_text = '官方版'; break;
  81.             case 'other': $license_type_text = '其他'; break;
  82.         }

  83.         $recommend_star = get_post_meta($post->ID, 'zib_recommend_star', true);
  84.         $recommend_star = $recommend_star ? str_repeat('★', $recommend_star) . str_repeat('☆', 5 - $recommend_star) : '★★★★★';

  85.         $update_date = get_the_date('Y年n月j日');

  86.         $extra_html = '
  87.         <div class="pc-content">
  88.             <div class="hide-on-mobile w820 ovf pad20 bgW tjApp" style="margin-bottom: 20px; border-radius: 8px; box-shadow: 0 0 10px var(--main-shadow);background-color: var(--main-bg-color);">
  89.                 <div class="app-info ovf">
  90.                     <b class="fl appImg"><img src="' . esc_url($img_url) . '" alt="' . get_the_title() . '" class="fit-cover"></b>
  91.                     <div class="fl">
  92.                         <h1 class="appName">' . get_the_title() . '</h1>
  93.                         <div class="theme-box article-tags">
  94.                             ' . $cat_links . '
  95.                             ' . $tag_links . '
  96.                         </div>
  97.                     </div>
  98.                 </div>
  99.                 <div class="detaBox">
  100.                     <div class="detaMain fl">
  101.                         <p><span>平台:</span>' . $platform_text . '</p>
  102.                         <p><span>大小:</span>' . $size_text . '</p>
  103.                         <p><span>版本:</span>' . $version_text . '</p>
  104.                         <p><span>授权:</span>' . $license_type_text . '</p>
  105.                         <p><span>推荐:</span>' . $recommend_star . '</p>
  106.                         <p><span>更新:</span>' . $update_date . '</p>
  107.                     </div>
  108.                     <div>
  109.                         <button onclick="scrollToTarget()" style="width: 180px; height: 50px; text-align: center; color: #fff; background: #008ded; display: block; font-size: 20px; margin: 0px auto 0 auto; border: none;">立即下载</button>
  110.                     </div>
  111.                 </div>
  112.             </div>
  113.         </div>';

  114.         $first_cat_name = $cat ? $cat[0]->name : '未分类';
  115.         $extra_html .= '
  116.         <div class="mobile-content">
  117.             <div class="hide-on-pc w100 ovf pad20 bgW tjApp" style="padding-left: 10px;padding-right: 10px;margin-bottom: 20px;border-radius: 8px;box-shadow: 0 0 10px var(--main-shadow);background-color: var(--main-bg-color);">
  118.                 <header id="info" style="min-height: 126px;">
  119.                     <img src="' . esc_url($img_url) . '" alt="' . get_the_title() . '" class="fit-cover" style="float:left;margin-right:10px;width:66px;height:66px;border-radius:8px;">
  120.                     <div class="name"><h1 style="font-size: 16px;">' . get_the_title() . '</h1></div>
  121.                     <div class="mobile-info-grid">
  122.                         <div><span>分类:</span>' . $first_cat_name . '</div>
  123.                         <div><span>大小:</span>' . $size_text . '</div>
  124.                         <div><span>更新:</span>' . $update_date . '</div>
  125.                         <div><span>平台:</span>' . $platform_text . '</div>
  126.                     </div>
  127.                     <div style="margin-top: 20px;">
  128.                         <button onclick="scrollToTarget()" style="width: 100%; height: 40px;color: #fff; background: #008ded; display: block; font-size: 18px; border: none;">立即下载</button>
  129.                     </div>
  130.                 </header>
  131.             </div>
  132.         </div>';

  133.         $zib_get_breadcrumbs = $lin . $extra_html;
  134.         return $zib_get_breadcrumbs;
  135.     }

  136.     $zib_get_breadcrumbs = '';
  137.     return $zib_get_breadcrumbs;
  138. }
复制代码

CSS代码
CSS代码我就不多说了,直接丢到:子比主题–>>自定义CSS样式即可!
  1. /*文章顶部*/
  2.         .mobile-content {
  3.             display: none;
  4.         }
  5.         .pc-content {
  6.             display: block;
  7.         }
  8.         @media (max-width: 768px) { /* 假设768px以下是移动端 */
  9.             .mobile-content {
  10.                 display: block;
  11.             }
  12.             .pc-content {
  13.                 display: none;
  14.             }
  15.         }
  16. .w820 {width: 100%;}
  17. .pad20 {padding: 20px;}
  18. .bgW {background-color: #fff;}

  19. .ovf {overflow: hidden;}

  20. body, input, textarea {font: 14px 'FAE\8F6F\96C5\9ED1';}
  21. .ovf {overflow: hidden;}

  22. .tjApp .app-info .appImg {margin-right: 20px;}
  23. .tjApp .app-info img {width: 85px;height: 85px;display: block;border-radius: 10px;}
  24. .fl {float: left;}
  25. .tjApp .app-info div.fl {width: 490px;}
  26. .tjApp .app-info .appName {color: var(--header-color);font-size: 20px;margin: 10px 0 15px 0;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 490px;}
  27. .tjApp .app-info .label {color: #333;font-size: 14px;}
  28. .tjApp .detaBox {margin-top: 10px;}
  29. .tjApp .detaBox .detaMain {width: 470px;}
  30. .fr {
  31.     float: right;
  32. }
  33. .tjApp .detaBox .downloadBtn a {
  34.     width: 200px;
  35.     height: 50px;
  36.     text-align: center;
  37.     line-height: 50px;
  38.     color: #fff;
  39.     background: #008ded;
  40.     display: block;
  41.     font-size: 20px;
  42.     margin: 0px auto 0 auto;
  43.     border-radius: 3px;
  44. }
  45. a:link, a:visited {
  46.     text-decoration: none;
  47. }
  48. .tjApp .app-info .article-share {
  49.     margin-top: 10px;
  50. }
  51. .article-share {
  52.     color: #333;
  53.     line-height: 25px;
  54. }
  55. .article-share span {
  56.     margin-top: 1px;
  57. }
  58. .tjApp .app-info .article-share div.fl {
  59.     width: auto;
  60. }
  61. .tjApp .detaBox .detaMain p {
  62.     float: left;
  63.     width: 32%;
  64.     height: 30px;
  65.     line-height: 30px;
  66.     color: var(--header-color);
  67.     overflow: hidden;
  68.     white-space: nowrap;
  69. }
  70. p {
  71.     margin: 0;
  72.     padding: 0;
  73.     font-size: 100%;
  74.     vertical-align: baseline;
  75.     border: 0;
  76.     outline: 0;
  77. }.enlighter-default .enlighter{max-height:400px;overflow-y:auto !important;}.posts-item .item-heading>a {font-weight: bold;color: unset;}@media (max-width:640px) {
  78.     .meta-right .meta-view{
  79.       display: unset !important;
  80.     }
  81.   }

  82. .mobile-info-grid {
  83.     display: flex;
  84.     flex-wrap: wrap;
  85.     margin-top: 10px;
  86. }
  87. .mobile-info-grid > div {
  88.     width: 50%;
  89.     box-sizing: border-box;
  90.     padding: 2px 0;
  91.     font-size: 14px;
  92.     color: #333;
  93.     line-height: 1.6;
  94. }
  95. @media (min-width: 768px) {
  96.     .mobile-info-grid { display: none; }
  97. }
复制代码

修复版本代码
func代码
定位:/wp-content/themes/zibll/func.php文件,没有这个文件自己创建一个,记得加上php头,要不然会报错,然后将下面的代码放到里面,其实下面的代码是放到metabox-options.php文件里面的,但是方便就放到func.php里面吧,修复版本这个代码不变
  1. if (class_exists('CSF')) {
  2.     CSF::createMetabox('zib_post_extra', array(
  3.         'title'      => '文章额外信息',
  4.         'post_type'  => array('post'),
  5.         'context'    => 'advanced',
  6.         'data_type'  => 'unserialize',
  7.     ));

  8.     $fields = array();

  9.     $fields[] = array(
  10.         'id'      => 'zib_platform',
  11.         'type'    => 'select',
  12.         'title'   => '平台',
  13.         'options' => array(
  14.             'android' => 'Android',
  15.             'ios'     => 'iOS',
  16.             'windows' => 'Windows',
  17.             'mac'     => 'Mac',
  18.             'linux'   => 'Linux',
  19.             'other'   => '其他',
  20.         ),
  21.         'default' => 'android'
  22.     );

  23.     $fields[] = array(
  24.         'id'    => 'zib_size',
  25.         'type'  => 'text',
  26.         'title' => '文件大小',
  27.         'desc'  => '如:21.3M'
  28.     );

  29.     $fields[] = array(
  30.         'id'    => 'zib_version',
  31.         'type'  => 'text',
  32.         'title' => '文件版本',
  33.         'desc'  => '如:v3.3.7'
  34.     );

  35.     $fields[] = array(
  36.         'id'    => 'zib_language',
  37.         'type'  => 'text',
  38.         'title' => '语言',
  39.         'desc'  => '如:简体中文'
  40.     );

  41.     $fields[] = array(
  42.         'id'      => 'zib_license_type',
  43.         'type'    => 'select',
  44.         'title'   => '授权类型',
  45.         'options' => array(
  46.             'free'      => '免费版',
  47.             'modified'  => '修改版',
  48.             'official'  => '官方版',
  49.             'other'     => '其他',
  50.         ),
  51.         'default' => 'official'
  52.     );

  53.     $fields[] = array(
  54.         'id'      => 'zib_recommend_star',
  55.         'type'    => 'select',
  56.         'title'   => '推荐星级',
  57.         'options' => array(
  58.             '1' => '★☆☆☆☆',
  59.             '2' => '★★☆☆☆',
  60.             '3' => '★★★☆☆',
  61.             '4' => '★★★★☆',
  62.             '5' => '★★★★★',
  63.         ),
  64.         'default' => '5'
  65.     );

  66.     CSF::createSection('zib_post_extra', array('fields' => $fields));
  67. }
  68. add_action('admin_head', function() {
  69.     echo '<style>
  70.     .csf-metabox .csf-field { margin-bottom: 6px !important; }
  71.     .csf-metabox .csf-field .csf-title { margin-bottom: 2px !important; }
  72.     .csf-metabox .csf-field + .csf-field { border-top: none !important; }
  73.     </style>';
  74. });
复制代码

single代码
定位:/wp-content/themes/ZibTF/inc/functions/zib-single.php,那么这个文件就是子比的页面的文件,然后我们找到下面的函数,大约在157行,如下图,修复版本这个代码要变,直接替换原版的就可
tengfei_down - 2025-10-10T164946.588.webp
把这整个函数全部替换成下面的代码,因为我改了里面的代码,你直接替换就行,记得备份一下,方便后面好更新,如果有子主题的话当我没说!
  1. function zib_get_breadcrumbs() {
  2.     static $zib_get_breadcrumbs = null;
  3.     if ($zib_get_breadcrumbs !== null) {
  4.         return $zib_get_breadcrumbs;
  5.     }

  6.     if (!is_single() || !_pz('breadcrumbs_single_s', true)) {
  7.         $zib_get_breadcrumbs = '';
  8.         return $zib_get_breadcrumbs;
  9.     }

  10.     $categorys = get_the_category();
  11.     if ($categorys) {
  12.         $category = $categorys[0];
  13.         $lin = '<ul class="breadcrumb">
  14.             <li><a href="' . get_bloginfo('url') . '"><i class="fa fa-map-marker"></i> ' . (!_pz('breadcrumbs_home_text', true) ? get_bloginfo('name') : '首页') . '</a></li><li>
  15.             ' . get_category_parents($category->term_id, true, ' </li><li> ') . (!_pz('breadcrumbs_single_text', true) ? get_the_title() : '正文') . '</li></ul>';

  16.         $post = get_post();
  17.         $size = 'full';
  18.         $img_url = wp_cache_get($post->ID, 'post_thumbnail_url_' . $size, true);

  19.         if (false === $img_url) {
  20.             $img_url = '';

  21.             $post_thumbnail_id = get_post_thumbnail_id($post->ID);
  22.             if ($post_thumbnail_id) {
  23.                 $image_src = zib_get_attachment_image_src($post_thumbnail_id, $size);
  24.                 $img_url   = isset($image_src[0]) ? $image_src[0] : '';
  25.             }

  26.             if (!$img_url) {
  27.                 $img_url = zib_get_post_meta($post->ID, 'thumbnail_url', true);
  28.             }

  29.             if (!$img_url && _pz('thumb_postfirstimg_s', true)) {
  30.                 $post_img_urls = zib_get_post_img_urls($post);
  31.                 $img_url       = isset($post_img_urls[0]) ? $post_img_urls[0] : '';
  32.                 if ($img_url && $size && 'full' !== $size) {
  33.                     $img_id = zib_get_image_id($img_url);
  34.                     if ($img_id) {
  35.                         $img = wp_get_attachment_image_src($img_id, $size);
  36.                         if (isset($img[0])) {
  37.                             $img_url = $img[0];
  38.                         }
  39.                     }
  40.                 }
  41.             }

  42.             wp_cache_set($post->ID, $img_url, 'post_thumbnail_url_' . $size, 3600);
  43.         }

  44.         if (!$img_url) {
  45.             $img_url = '默认封面图片链接';
  46.         }

  47.         $cat = get_the_category();
  48.         $cat_links = '';
  49.         $category_colors = ['blue', 'green', 'yellow', 'red', 'purple'];
  50.         foreach ($cat as $index => $category) {
  51.             $color = $category_colors[$index % count($category_colors)];
  52.             $cat_links .= '<a class="but ml6 radius c-' . $color . '" href="' . get_category_link($category->term_id) . '" title="查看此分类更多文章"><i class="fa fa-folder-open-o"></i>' . $category->name . '</a> ';
  53.         }

  54.         $tags = get_the_tags();
  55.         $tag_links = '';
  56.         if ($tags) {
  57.             foreach ($tags as $tag) {
  58.                 $tag_links .= '<a class="but ml6 radius" title="查看此标签更多文章" href="' . get_tag_link($tag->term_id) . '">#' . $tag->name . '</a>';
  59.             }
  60.         }

  61.         $platform = get_post_meta($post->ID, 'zib_platform', true);
  62.         $platform_map = [
  63.             'android' => 'Android',
  64.             'ios' => 'iOS',
  65.             'windows' => 'Windows',
  66.             'mac' => 'Mac',
  67.             'linux' => 'Linux',
  68.             'other' => '其他'
  69.         ];
  70.         $platform_text = isset($platform_map[$platform]) ? $platform_map[$platform] : 'Android';

  71.         $size_text = get_post_meta($post->ID, 'zib_size', true);
  72.         $size_text = $size_text ? $size_text : '未知';

  73.         $version_text = get_post_meta($post->ID, 'zib_version', true);
  74.         $version_text = $version_text ? $version_text : '未知';

  75.         $license_type = get_post_meta($post->ID, 'zib_license_type', true);
  76.         $license_type_text = '官方版'; // 默认
  77.         switch ($license_type) {
  78.             case 'free': $license_type_text = '免费版'; break;
  79.             case 'modified': $license_type_text = '修改版'; break;
  80.             case 'official': $license_type_text = '官方版'; break;
  81.             case 'other': $license_type_text = '其他'; break;
  82.         }

  83.         $recommend_star = get_post_meta($post->ID, 'zib_recommend_star', true);
  84.         $recommend_star = $recommend_star ? str_repeat('★', $recommend_star) . str_repeat('☆', 5 - $recommend_star) : '★★★★★';

  85.         $update_date = get_the_date('Y年n月j日');

  86.         // 判断是否有资源下载
  87.         $pay_mate = get_post_meta($post->ID, 'posts_zibpay', true);
  88.         $has_download = false;
  89.         if (!empty($pay_mate['pay_download']) && is_array($pay_mate['pay_download'])) {
  90.             foreach ($pay_mate['pay_download'] as $item) {
  91.                 if (!empty($item['link'])) {
  92.                     $has_download = true;
  93.                     break;
  94.                 }
  95.             }
  96.         }

  97.         $extra_html = '';

  98.         if ($has_download) {
  99.             // PC端
  100.             $extra_html .= '
  101.             <div class="pc-content">
  102.                 <div class="hide-on-mobile w820 ovf pad20 bgW tjApp" style="margin-bottom: 20px; border-radius: 8px; box-shadow: 0 0 10px var(--main-shadow);background-color: var(--main-bg-color);">
  103.                     <div class="app-info ovf">
  104.                         <b class="fl appImg"><img src="' . esc_url($img_url) . '" alt="' . get_the_title() . '" class="fit-cover"></b>
  105.                         <div class="fl">
  106.                             <h1 class="appName">' . get_the_title() . '</h1>
  107.                             <div class="theme-box article-tags">
  108.                                 ' . $cat_links . '
  109.                                 ' . $tag_links . '
  110.                             </div>
  111.                         </div>
  112.                     </div>
  113.                     <div class="detaBox">
  114.                         <div class="detaMain fl">
  115.                             <p><span>平台:</span>' . $platform_text . '</p>
  116.                             <p><span>大小:</span>' . $size_text . '</p>
  117.                             <p><span>版本:</span>' . $version_text . '</p>
  118.                             <p><span>授权:</span>' . $license_type_text . '</p>
  119.                             <p><span>推荐:</span>' . $recommend_star . '</p>
  120.                             <p><span>更新:</span>' . $update_date . '</p>
  121.                         </div>
  122.                         <div>
  123.                             <button onclick="scrollToTarget()" style="width: 180px; height: 50px; text-align: center; color: #fff; background: #008ded; display: block; font-size: 20px; margin: 0px auto 0 auto; border: none;">立即下载</button>
  124.                         </div>
  125.                     </div>
  126.                 </div>
  127.             </div>';

  128.             // 移动端
  129.             $first_cat_name = $cat ? $cat[0]->name : '未分类';
  130.             $extra_html .= '
  131.             <div class="mobile-content">
  132.                 <div class="hide-on-pc w100 ovf pad20 bgW tjApp" style="padding-left: 10px;padding-right: 10px;margin-bottom: 20px;border-radius: 8px;box-shadow: 0 0 10px var(--main-shadow);background-color: var(--main-bg-color);">
  133.                     <header id="info" style="min-height: 126px;">
  134.                         <img src="' . esc_url($img_url) . '" alt="' . get_the_title() . '" class="fit-cover" style="float:left;margin-right:10px;width:66px;height:66px;border-radius:8px;">
  135.                         <div class="name"><h1 style="font-size: 16px;">' . get_the_title() . '</h1></div>
  136.                         <div class="mobile-info-grid">
  137.                             <div><span>分类:</span>' . $first_cat_name . '</div>
  138.                             <div><span>大小:</span>' . $size_text . '</div>
  139.                             <div><span>更新:</span>' . $update_date . '</div>
  140.                             <div><span>平台:</span>' . $platform_text . '</div>
  141.                         </div>
  142.                         <div style="margin-top: 20px;">
  143.                             <button onclick="scrollToTarget()" style="width: 100%; height: 40px;color: #fff; background: #008ded; display: block; font-size: 18px; border: none;">立即下载</button>
  144.                         </div>
  145.                     </header>
  146.                 </div>
  147.             </div>';
  148.         }

  149.         $zib_get_breadcrumbs = $lin . $extra_html;
  150.         return $zib_get_breadcrumbs;
  151.     }

  152.     $zib_get_breadcrumbs = '';
  153.     return $zib_get_breadcrumbs;
  154. }
复制代码

CSS代码
CSS代码我就不多说了,直接丢到:子比主题–>>自定义CSS样式即可,修复版本css代码不动
  1. /*文章顶部*/
  2.         .mobile-content {
  3.             display: none;
  4.         }
  5.         .pc-content {
  6.             display: block;
  7.         }
  8.         @media (max-width: 768px) { /* 假设768px以下是移动端 */
  9.             .mobile-content {
  10.                 display: block;
  11.             }
  12.             .pc-content {
  13.                 display: none;
  14.             }
  15.         }
  16. .w820 {width: 100%;}
  17. .pad20 {padding: 20px;}
  18. .bgW {background-color: #fff;}

  19. .ovf {overflow: hidden;}

  20. body, input, textarea {font: 14px 'FAE\8F6F\96C5\9ED1';}
  21. .ovf {overflow: hidden;}

  22. .tjApp .app-info .appImg {margin-right: 20px;}
  23. .tjApp .app-info img {width: 85px;height: 85px;display: block;border-radius: 10px;}
  24. .fl {float: left;}
  25. .tjApp .app-info div.fl {width: 490px;}
  26. .tjApp .app-info .appName {color: var(--header-color);font-size: 20px;margin: 10px 0 15px 0;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 490px;}
  27. .tjApp .app-info .label {color: #333;font-size: 14px;}
  28. .tjApp .detaBox {margin-top: 10px;}
  29. .tjApp .detaBox .detaMain {width: 470px;}
  30. .fr {
  31.     float: right;
  32. }
  33. .tjApp .detaBox .downloadBtn a {
  34.     width: 200px;
  35.     height: 50px;
  36.     text-align: center;
  37.     line-height: 50px;
  38.     color: #fff;
  39.     background: #008ded;
  40.     display: block;
  41.     font-size: 20px;
  42.     margin: 0px auto 0 auto;
  43.     border-radius: 3px;
  44. }
  45. a:link, a:visited {
  46.     text-decoration: none;
  47. }
  48. .tjApp .app-info .article-share {
  49.     margin-top: 10px;
  50. }
  51. .article-share {
  52.     color: #333;
  53.     line-height: 25px;
  54. }
  55. .article-share span {
  56.     margin-top: 1px;
  57. }
  58. .tjApp .app-info .article-share div.fl {
  59.     width: auto;
  60. }
  61. .tjApp .detaBox .detaMain p {
  62.     float: left;
  63.     width: 32%;
  64.     height: 30px;
  65.     line-height: 30px;
  66.     color: var(--header-color);
  67.     overflow: hidden;
  68.     white-space: nowrap;
  69. }
  70. p {
  71.     margin: 0;
  72.     padding: 0;
  73.     font-size: 100%;
  74.     vertical-align: baseline;
  75.     border: 0;
  76.     outline: 0;
  77. }.enlighter-default .enlighter{max-height:400px;overflow-y:auto !important;}.posts-item .item-heading>a {font-weight: bold;color: unset;}@media (max-width:640px) {
  78.     .meta-right .meta-view{
  79.       display: unset !important;
  80.     }
  81.   }

  82. .mobile-info-grid {
  83.     display: flex;
  84.     flex-wrap: wrap;
  85.     margin-top: 10px;
  86. }
  87. .mobile-info-grid > div {
  88.     width: 50%;
  89.     box-sizing: border-box;
  90.     padding: 2px 0;
  91.     font-size: 14px;
  92.     color: #333;
  93.     line-height: 1.6;
  94. }
  95. @media (min-width: 768px) {
  96.     .mobile-info-grid { display: none; }
  97. }
复制代码

JS代码
修复版本要多加一个JS代码,直接丢到:子比主题–>>自定义javascript代码
  1. function scrollToTarget() {
  2.   var target = document.querySelector('.box-body.relative');
  3.   if (target) {
  4.     var rect = target.getBoundingClientRect();
  5.     var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
  6.     var offset = 100;
  7.     window.scrollTo({
  8.       top: rect.top + scrollTop - offset,
  9.       behavior: 'smooth'
  10.     });
  11.   }
  12. }
复制代码

本帖被以下淘专辑推荐:

路虽远,行则将至;事虽难,做则必成。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

飞流广播+ 发布

07-23 18:52
飞流这论坛到底有没有资本给我投资一下啊!
07-20 22:07
系统消息:飞流安卓客户端APP已上线,请在QQ群(123129)群文件内获取下载。
02-21 02:22
01-24 12:40
站内通告

📢 六月份后均不在线,请悉知

提供资源交易、信息共享、靓号交流、技术变现、学习问答、兴趣娱乐等全面服务。

1.丰富功能系统,扩展社区特色玩法,打造最好的互联网聚集圈子。

2.准确信息真实交易,安全快捷又方便,让虚拟交易面对面。

3. 天上不会掉馅饼,话术骗术迷人心,切勿脱离平台线下交易,被骗与平台无关!

4. 欺诈骗钱,违规违法将视情受到警告&禁言&封号甚至检举至👮🏻‍♀️处理!

官方Q群:1003810038钉推群:BAYR2383 站长QQ:3388700000

飞流论坛(FLLT.CN),一个专注于资源信息发布、虚拟网络交易、技术学习与娱乐社交的交流平台。
  • 钉钉新帖推送群
  • 官方交流QQ群
  • 站长唯一微信号

💥客户端|🧿小黑屋|📴手机页|飞流网 |网站地图

GMT+8, 2026-8-17 09:56 , Processed in 0.071502 second(s), 67 queries, MemCached On , Gzip On.

飞流论坛 HanAnalytics icp

Copyright © 2024-2026 飞流网 版权所有 All Rights Reserved. X3.5

快速回复 返回顶部 返回列表