标签归档:wordpress

WordPress分页插件WP-PageNavi使用记录

1、安装插件

2、找到主题文件夹的functions.php文件中的以下代码

<nav id="<?php echo esc_attr( $html_id ); ?>" class="navigation"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div>

替换为:

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

wordpress代码添加下载按钮

在自定义主题-额外CSS处填入如下代码

.button {
    border-radius: 5px;
    color: #ffffff!important;
    display: inline-block;
    margin-right: 10px;
	  margin-bottom: 10px;
    padding: 7px 10px;
	background-color: #3bc492;
	text-decoration: none!important;
	text-indent: 0!important;
}
.button2 {
    border-radius: 5px;
    color: #ffffff!important;
    display: inline-block;
    margin-right: 10px;
	  margin-bottom: 10px;
    padding: 7px 10px;
	background-color: #CC00CC;
	text-decoration: none!important;
	text-indent: 0!important;
}

在编辑器中使用如下格式调用:

<p style="text-align: center;"><a class="button" href="https://google.com" target="_blank" rel="noopener">MediaFire</a></p>

<p style="text-align: center;"><a class="button2" href="https://www.baidu.com" target="_blank" rel="noopener">77File</a></p>

 

Google Search Console无法读取网站地图的解决办法

导致Google Search Console 中发现了一个 网址已提交,但带有“noindex”标记 的错误提示的可能原因主要有2种:
1. 在网站robots.txt中人为设置了禁止收录的URL
如果你在网站的 robots.txt 文件中设置了禁止某些网页被抓取收录的话,可能会出现这种错误提示。比如,我们希望有些特殊的网站页面(用户注册登录、会员中心、购物车、线上支付)不让搜索引擎抓取收录,我们可能会在网站robots.txt 文件中设置了禁止搜索引擎抓取这些页面。

继续阅读

为 WordPress 加入 Redis 缓存优化访问性能

安装 Redis 缓存

我这次安装 Redis 缓存选择了 Redis Object Cache 这个插件。

Redis Object Cache

和你在别的网站上看到的教程相比,这个插件提供了一个可视化的查看和管理的方式,对于懒得手动操作和编辑代码的人来说,更加友好。

安装插件后,启用插件,你可以在设置中的「Redis」设置页面找到如下的界面:

设置页面

点击 Enable Object Cache,就会开启 Redis 的 Object Cache 。 继续阅读