function zib_get_breadcrumbs() { static $zib_get_breadcrumbs = null; if ($zib_get_breadcrumbs !== null) { return $zib_get_breadcrumbs; } if (!is_single() || !_pz('breadcrumbs_single_s', true)) { $zib_get_breadcrumbs = ''; return $zib_get_breadcrumbs; } $post = get_post(); $SoftInfo_switch = get_post_meta($post->ID, 'zib_SoftInfo_switch', true); if ($SoftInfo_switch === 'yes') { $categorys = get_the_category(); if ($categorys) { $category = $categorys[0]; // 原生面包屑,增加宽度限制class $lin = '
'; // 缩略图缓存逻辑 $size = 'full'; $img_url = wp_cache_get($post->ID, 'post_thumbnail_url_' . $size, true); if (false === $img_url) { $img_url = ''; $post_thumbnail_id = get_post_thumbnail_id($post->ID); if ($post_thumbnail_id) { $image_src = zib_get_attachment_image_src($post_thumbnail_id, $size); $img_url = isset($image_src[0]) ? $image_src[0] : ''; } if (!$img_url) { $img_url = zib_get_post_meta($post->ID, 'thumbnail_url', true); } if (!$img_url && _pz('thumb_postfirstimg_s', true)) { $post_img_urls = zib_get_post_img_urls($post); $img_url = isset($post_img_urls[0]) ? $post_img_urls[0] : ''; } wp_cache_set($post->ID, $img_url, 'post_thumbnail_url_' . $size, 3600); } if (!$img_url) $img_url = zib_get_spare_thumb(); // 修复分类标签样式 $cat = get_the_category(); $cat_links = ''; foreach ($cat as $category) { $cat_links .= '' . $category->name . ' '; } $tags = get_the_tags(); $tag_links = ''; if ($tags) { foreach ($tags as $tag) { $tag_links .= '#' . $tag->name . ''; } } // 软件信息字段 $platform = get_post_meta($post->ID, 'zib_platform', true); $platform_map = [ 'android' => 'Android', 'ios' => 'iOS', 'windows' => 'Windows', 'mac' => 'Mac', 'linux' => 'Linux', 'other' => '其他' ]; $platform_text = $platform_map[$platform] ?? 'Android'; $size_text = get_post_meta($post->ID, 'zib_size', true) ?: '未知'; $version_text = get_post_meta($post->ID, 'zib_version', true) ?: '未知'; $license_type = get_post_meta($post->ID, 'zib_license_type', true); $license_text = [ 'free' => '2H4G', 'modified' => '4H8G', 'official' => '8H8G', 'other' => '8H16G' ][$license_type] ?? '官方版'; $star = get_post_meta($post->ID, 'zib_recommend_star', true) ?: 5; $star_text = str_repeat('★', $star) . str_repeat('☆', 5 - $star); $update_date = get_the_date('Y年n月j日'); $download_url = home_url('/download/?post=' . get_the_ID()); // PC卡片 $extra_html = ' '; // 移动端卡片 $extra_html .= ' '; $zib_get_breadcrumbs = $lin . $extra_html; return $zib_get_breadcrumbs; } } $zib_get_breadcrumbs = ''; return $zib_get_breadcrumbs; }