Skip to content

Commit

Permalink
兼容图标未设置情况,不输出mate
Browse files Browse the repository at this point in the history
  • Loading branch information
Lvshujun0918 committed Mar 25, 2024
1 parent 07f5ec2 commit f87dae9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 20 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,26 @@ function pk_breadcrumbs()
return $out;
}

/**
* 返回图标信息
*
* @return string
* @author lvshujun
* @date 2024-03-19
*/
function pk_icon_mate() {
//获取icon地址
$pk_icon = pk_get_option('favicon');
//未设置返回空
if ($pk_icon === '') return '';

//连接字符串
$str = '<link rel="shortcut icon" href="' . $pk_icon . '">
<link rel="apple-touch-icon" href="' . $pk_icon . '"/>';

return $str;
}

//获取阅读数量
function pk_get_post_views()
{
Expand Down
3 changes: 1 addition & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv='content-language' content='<?php echo get_locale() ?>'>
<link rel="shortcut icon" href="<?php echo pk_get_option('favicon') ?>">
<link rel="apple-touch-icon" href="<?php echo pk_get_option('favicon') ?>"/>
<?php echo pk_icon_mate(); ?>
<?php if(pk_is_checked('seo_open',true)) get_template_part('inc/seo') ?>
<?php wp_head(); ?>
<?php if (!empty(pk_get_option('tj_code_header', ''))): ?>
Expand Down

0 comments on commit f87dae9

Please sign in to comment.