本网站相关设置方法,阿里云OSS使用后数据库修改,Wordpress关键词替换,wordpress插入视频

1、使用阿里云OSS后数据库替换

UPDATE wp_posts SET post_content = REPLACE(post_content,'liuhaiying.oss-cn-beijing.aliyuncs.com/wp-content/uploads/','liuhaiying.cn/wp-content/uploads/');

http://www.liuhaiying.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2016/09/092716_0028_1.jpg
http://liuhaiying.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2016/09/092716_0028_1.jpg

2、替换文章标题、内容关键字

UPDATE wp_posts SET post_content = replace(post_content, '<div><a title="来自为知笔记(Wiz)" href="http://www.wiz.cn/i/faead6ec">来自为知笔记(Wiz)</a></div>',' ');

update wp_posts set post_title=REPLACE(post_title,"-有意思吧","")

3、SEO,Search Engine Optimization搜索引擎优化

(1)网站关键词设置

<meta name="keywords" content="心灵鸡汤,英语美文,实用礼仪, 几米漫画, 职业规划,温情小人书,乐游天下,英语学习,生活百科,心情随笔,文案创意,外贸实战,职业学院,计算机技术,移动生活" />
<meta name="description" content="想/说 想最想的想,说最想的说 我的小站 我的网站"/>

(2)全站设置

<?php
//如果是首页
if (is_home()){
$keywords = "你网站首页的关键字,自己修改吧";
$description = "你网站首页的描述,自己修改吧";
}
//如果是文章页
elseif (is_single()){
//默认使用文章页添加关键字
$keywords = get_post_meta($post->ID, "keywords", true);
//如果为空,使用标签作为关键字
if($keywords == ""){
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag){
$keywords = $keywords.$tag->name.",";
}
//去掉最后一个,
$keywords = rtrim($keywords, ', ');
}
//默认使用文章页添加描述
$description = get_post_meta($post->ID, "description", true);
//如果为空,使用文章前100个字作为描述
if($description == ""){
if($post->post_excerpt){
$description = $post->post_excerpt;
}else{
$description = mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)),0,200);
}
}
}
//如果是页面,使用页面添加的关键字和描述
elseif (is_page()){
$keywords = get_post_meta($post->ID, "keywords", true);
$description = get_post_meta($post->ID, "description", true);
}
//如果是分类页,使用分类名作为关键字,分类描述作为描述
elseif (is_category()){
$keywords = single_cat_title('', false);
$description = category_description();
}
//如果是标签页,使用标签名作为关键字,标签描述作为描述
elseif (is_tag()){
$keywords = single_tag_title('', false);
$description = tag_description();
}
//去掉两段空格
$keywords = trim(strip_tags($keywords));
$description = trim(strip_tags($description));
?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<meta name="description" content="<?php echo $description; ?>" />

4、视频嵌入

<embed src="http://liuhaiying.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2020/03/%E5%8F%A3%E5%9E%8Bp.mp4" type="application/x-shockwave-flash" width="120" height="120" wmode="opaque">

<embed src="http://liuhaiying.oss-cn-beijing.aliyuncs.com/wp-content/resource/english/yinbiao/p%3D33506/01.swf" type="application/x-shockwave-flash" width="700" height="500" wmode="opaque">

<embed width="100%" height="100%" name="plugin" id="plugin" src="http://i.xiao84.com/en-yinbiao/phonemicchart/01.swf" type="application/x-shockwave-flash">

5、主题TwentyTwelve安装WP-PageNavi插件后不可用解决方法

修改主题文件functions.php中的:

<h3 class=”assistive-text”><?php _e( ‘Post navigation’, ‘twentytwelve’ ); ?></h3>
<div class=”nav-previous alignleft”><?php next_posts_link( __( ‘<span class=”meta-nav”>&larr;</span> Older posts’, ‘twentytwelve’ ) ); ?></div>
<div class=”nav-next alignright”><?php previous_posts_link( __( ‘Newer posts <span class=”meta-nav”>&rarr;</span>’, ‘twentytwelve’ ) ); ?></div>

替换为:

<?php wp_pagenavi(); ?>

6、如何删除"自豪地采用WordPress"

修改footer.php,删除以下代码就可以了:

<?php printf( __('Proudly powered by %s.', 'twentyten'), 'WordPress' ); ?>

也可以直接删除下面这一整段:

<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyeleven' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyeleven' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'twentyeleven' ), 'WordPress' ); ?></a>

拓展1:如何修改"自豪地采用 WordPress" 即自定义此功能

还是在footer.php文件找到这段:

<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyeleven' ) ); ?>"

title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyeleven' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'twentyeleven' ), 'WordPress' ); ?></a>

修改成:

<a href="<?php echo esc_url( __( '/', 'twentyeleven' ) ); ?>" title="<?php esc_attr_e( '鼠标放在上面显示的文字(即说明文字)', 'twentyeleven' ); ?>"rel="generator"><?php printf( __( '%s', 'twentyeleven' ), '填你要修改的内容' ); ?></a>

注意:<a href="<?php echo esc_url( __( '/', 'twentyeleven' ) ); ?>" 这里'/'代替你想要跳转的网站链接。具体原因这里不做解释。如果直接填写网站链接,是错误的网址,不信可以试试。

如果想加粗文字,可以加strong标记。如果想将文字居中,最笨的方法,在“<a href=”前面,加&nbsp,直到它移到你想要的位置。最终达到满意效果。

拓展2:国内备案需要添加网站备案号,可以添加以下信息:

<div><a href="http://www.beian.miit.gov.cn/">京ICP备0000000号-1</a></div>

 

 

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据