WordPress一些二次修改

1,文章头部尾部添加广告。

2,Vantage theme delete ‘A SiteOrigin Theme’

Vantage: footer.php (parts/footer.php)

local:/wp-content/themes/vantage/parts/footer.php

<?php echo apply_filters( 'vantage_footer_attribution', '<div id="theme-attribution">' . sprintf( __('A <a href="%s">SiteOrigin</a> Theme', 'vantage'), 'https://siteorigin.com') . '</div>' ) ?>

3,Wordpress标题,关键字等

在主题的header.php里边:
<title><?php if ( is_home() ) {
        bloginfo('name'); echo "|";  bloginfo('description');
    } elseif ( is_category() ) {
        single_cat_title(); echo "|"; bloginfo('name');
    } elseif (is_single() || is_page() ) {
        single_post_title(); echo "|";bloginfo('name');
    } elseif (is_search() || is_tag() || is_archive() ) {
        echo "搜索结果"; echo "|"; bloginfo('name');
    } elseif (is_404() ) {
        echo '页面未找到|'; bloginfo('name');
    } else {
        wp_title('',true);
    } ?>
</title>
<meta name="keywords" content="<?php if ( is_home() ) {
        echo "最好的解酒药|解酒产品|解酒方法|什么解酒药好|国外解酒药|解酒茶 - ";  bloginfo('name');
    } elseif ( is_category() ) {
        single_cat_title(); echo " - "; bloginfo('name');
    } elseif (is_single() || is_page() ) {
        single_post_title(); echo " - ";bloginfo('name');
    } elseif (is_search() || is_tag() || is_archive() ) {
        echo "搜索结果"; echo " - "; bloginfo('name');
    } elseif (is_404() ) {
        echo '页面未找到|'; bloginfo('name');
    } else {
        wp_title('',true); echo " - ";bloginfo('name');
    } ?>"/>
<meta name="description" content="<?php if ( is_home() ) {
        echo "最好的解酒药|解酒产品|解酒方法|什么解酒药好|国外解酒药|解酒茶 - ";  bloginfo('name');
    } elseif ( is_category() ) {
        single_cat_title(); echo " - "; bloginfo('name');
    } elseif (is_single() || is_page() ) {
        single_post_title(); echo " - ";bloginfo('name');
    } elseif (is_search() || is_tag() || is_archive() ) {
        echo "搜索结果"; echo " - "; bloginfo('name');
    } elseif (is_404() ) {
        echo '页面未找到|'; bloginfo('name');
    } else {
        wp_title('',true); echo " - ";bloginfo('name');
    } ?>"/>

4,判断是否是首页:

<?php wp_reset_query(); if ( is_home() ) { ?> 
我只会在首页显示
<?php } ?>

5,隐藏文章评论区的email和website:

//
/*
 *	 移除email表单和website表单开始
 */
function url_filtered($fields) { 
    if(isset($fields['url'])) 
        unset($fields['url']); 
    return $fields; 
} 
add_filter('comment_form_default_fields', 'url_filtered'); 
add_filter('comment_form_defaults','remove_email'); 

function remove_email($comment_form_html_arr){ 
    unset($comment_form_html_arr['fields']['email']); 
    $comment_form_html_arr['comment_notes_before'] = '<p class="comment-notes">'.sprintf( ' ' . __( 'Required fields are marked %s' ), '<span class="required">*</span>' ).'</p>'; 
    return $comment_form_html_arr; 
}
/*
 *	 移除email表单和website表单结束
 */
//

Leave a Reply

Required fields are marked *