新增文件列表
- add.css
- favicon.ico
- func-add.php
functions.php
1. 第116行 Google font函数改为:
if ( 'off' !== _x( 'on', 'Google font: on or off', 'upscale' ) ) {
$font_url = get_stylesheet_directory_uri() . '/inc/fonts/font.css';
}
2. 最后引入自定义functions:
include('func-add.php');
content.php
1. 第58行 has_post_thumbnail() 函数抓取文章第1张图片(优先级为:特色图片>文章第1章图片>后台默认图片),配合自定义函数使用:
} elseif( catch_that_image() ) {
$img_url = catch_that_image();
2. 第78行 if( has_post_thumbnail() || ot_get_option(‘default_post_image’))改为:
if( has_post_thumbnail()){
$thumbnail = '<a class="post-preview" href="'. esc_url($post_link) .'" target="'. esc_attr($post_link_target). '" rel="bookmark"><div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">'. get_the_post_thumbnail( null, 'large') .'<meta itemprop="url" content="'. esc_url($meta_image[0]) .'"><meta itemprop="width" content="'. esc_attr($meta_image[1]) .'"><meta itemprop="height" content="'. esc_attr($meta_image[2]) .'"></div></a>';
$thumbnail_bg = $img_url;
} elseif ( catch_that_image() ){
$thumbnail = '<a class="post-preview" href="'. esc_url($post_link) .'" target="'. esc_attr($post_link_target). '" rel="bookmark"><div itemprop="image" itemscope itemtype="https://schema.org/ImageObject"><img src="'. catch_that_image() .'" class="attachment-large size-large wp-post-image" alt=""><meta itemprop="url" content="'. esc_url($meta_image[0]) .'"><meta itemprop="width" content="'. esc_attr($meta_image[1]) .'"><meta itemprop="height" content="'. esc_attr($meta_image[2]) .'"></div></a>';
$thumbnail_bg = $img_url;
} elseif ( ot_get_option('default_post_image')){
$thumbnail = '<a class="post-preview" href="'. esc_url($post_link) .'" target="'. esc_attr($post_link_target). '" rel="bookmark"><div itemprop="image" itemscope itemtype="https://schema.org/ImageObject"><img src="'. esc_url($meta_image[0]) .'" class="attachment-large size-large wp-post-image" alt=""><meta itemprop="url" content="'. esc_url($meta_image[0]) .'"><meta itemprop="width" content="'. esc_attr($meta_image[1]) .'"><meta itemprop="height" content="'. esc_attr($meta_image[2]) .'"></div></a>';
$thumbnail_bg = $img_url;
}
3. 第92行 if( $post_style == ‘2’ ) 之后加入判断是否为mobile端,并执行:
<?php if (wp_is_mobile() ): ?>
<a class="post-preview-m" href="<?php echo esc_url(get_permalink()); ?>" target="_self" rel="bookmark">
<div itemprop="image" itemscope="" itemtype="https://schema.org/ImageObject">
<img src="<?php echo $thumbnail_bg; ?>" class="attachment-large size-large wp-post-image">
</div>
</a>
<div class="p-li-status">
<?php $count = get_post_meta($id, '_meta_radio_value', true);
if(!$count){
$count = '';
} elseif($count=='1') {
$count = '';
} elseif($count=='2') {
$count = '<div class="posi-li-open"></div>';
} elseif($count=='3') {
$count = '<div class="posi-li-filled"></div>';
}
echo $count;
?>
</div>
<?php if ( ot_get_option('post_category_blog') != 'off' ) : ?>
<div class="entry-category"><?php the_category( ', ' ); ?></div>
<?php endif; ?>
<header class="post-entry-header">
<h2 itemprop="headline" class="entry-title"><a itemprop="mainEntityOfPage" href="<?php echo esc_url($post_link) ?>" target="<?php echo esc_attr($post_link_target) ?>" title="<?php printf( esc_attr__( 'View %s', 'upscale' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
</header><!-- .entry-header -->
<?php mnky_blog_meta(); ?>
<?php echo $rating; ?>
<?php if ( $content_type == 'full_content' && strlen(get_the_content()) > 0 ) :
echo '<div itemprop="articleBody" class="entry-content">';
$more_link_text = esc_html__('Read more','upscale');
the_content($more_link_text);
echo '</div><!-- .entry-content -->';
elseif ( $content_type == 'excerpt' && strlen(get_the_excerpt()) > 0) :
echo '<div itemprop="articleBody" class="entry-summary">';
the_excerpt();
echo '</div><!-- .entry-summary -->';
else :
// No content
endif; ?>
<?php echo $article_share; ?>
<?php else : ?>
4. 第171行 </div><!– .post-content-bg –> 后加入post-status代码,配合使用:
<div class="p-li-status">
<?php $count = get_post_meta($id, '_meta_radio_value', true);
if(!$count){
$count = '';
} elseif($count=='1') {
$count = '';
} elseif($count=='2') {
$count = '<div class="posi-li-open"></div>';
} elseif($count=='3') {
$count = '<div class="posi-li-filled"></div>';
}
echo $count;
?>
</div>
<?php endif ;?>
5. 第193行 <?php echo $thumbnail; ?><?php endif; ?> 之后,为Style-1加入post-status代码:
<div class="p-li-status">
<?php $count = get_post_meta($id, '_meta_radio_value', true);
if(!$count){
$count = '';
} elseif($count=='1') {
$count = '';
} elseif($count=='2') {
$count = '<div class="posi-li-open"></div>';
} elseif($count=='3') {
$count = '<div class="posi-li-filled"></div>';
}
echo $count;
?>
</div>
content-single.php
1. 第16行 </header><!– .entry-header –> 后加入post-status:
<div class="p-status">
<?php $count = get_post_meta($id, '_meta_radio_value', true);
if(!$count){
$count = '';
} elseif($count=='1') {
$count = '';
} elseif($count=='2') {
$count = '<div class="posi-open"></div>';
} elseif($count=='3') {
$count = '<div class="posi-filled"></div>';
}
echo $count;
?>
</div>
2. 第67行 </div><!– .entry-content wrapper –> 后,加入文章底部点赞分享代码:
<?php if(is_singular('post')){ ?>
<div class="slmwp_share">
<span class="like">
<a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" class="wp-share shareed favorite <?php if(isset($_COOKIE['go2do_zan_'.$post->ID])) echo 'done';?>"><?php _e('Like', 'upscale') ?> <span class="count"><?php if( get_post_meta($post->ID,'go2do_zan',true) ){ echo get_post_meta($post->ID,'go2do_zan',true); } else { echo '0'; }?></span></a>
</span>
<span class="shang-p">
<a id="shang" href="javascript:;"></a>
</span>
<span class="share-s">
<a id="share" href="javascript:;"><?php _e('Share', 'upscale') ?></a>
</span>
<div class="clear"></div>
</div>
<?php } ?>
footer.php
1. 在底部</body>前引入网站弹窗代码:
<?php include('inc/pop/pop.php');?>
header.php
1. 在<head>中加入favicon代码:
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri() ?>/favicon.ico">
2. 在</head>前添加关键词、页面描述、头部自定义代码:
<?php if (is_page()){
$title = $post->post_title.' - '.get_bloginfo('name');
if ($post->post_excerpt){ //如果有输入描述,就调用描述
$description = $post->post_excerpt;
} else { //否则调用前400字符
$description = substr(strip_tags($post->post_content),0,400);
}
$keywords = $post->post_title; //关键词等于标题,当然,你可以通过上面的代码也添加一个关键词字段
} ?>
<meta name="keywords" content="<?php echo $keywords ?>" />
<meta name="description" content="<?php echo strip_tags(trim($description)); ?>" />
<?php if( ot_get_option('head_code') != '' ) : ?>
<?php echo ot_get_option('head_code'); ?>
<?php endif; ?>
3. 在底部 <?php get_template_part( ‘pre-content’ ); // Include pre-content.php ?> 之后,引入首页Slider代码:
<?php include('inc/slider/slider.php');?>
site-header.php
1. 第38行 <?php get_sidebar(‘mobile-header’); ?> 之后加入手机端站点语言切换menu:
<?php if ( has_nav_menu('secondary') ) : ?>
<?php wp_nav_menu( array( 'theme_location' => 'secondary', 'container' => false, 'fallback_cb' => '', 'items_wrap' => '<div class="mobile-langs"><ul id="%1$s" class="%2$s">%3$s</ul></div>', 'walker' => new mnky_walker() ) ); ?>
<?php endif; ?>
title.php
1. 自定义面包屑导航,将文件所有如下代码替换为:<?php if(function_exists('breadnav')) {breadnav();}?>
<?php if(function_exists('bcn_display')) {
echo '<div class="mnky_breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">';
bcn_display();
echo '</div>';
}?>