知更鸟begin主题美化

知更鸟begin主题美化

一直以来爱游都是用的知更鸟的begin主题,当然爱游是用的破解版,前几天爱游买了一个正版begin主题,这里分享下以前爱游做的一些美化,有些在最新版的主题里面已经不适用了所以也算是记录,万一哪天我忘了呢。以后也会不定期的更新一些知更鸟begin主题美化,以最...

给长期无更新旧文章增加自定义提示内容

首先:打开【/inc/options/begin-options.php】文件,在适当位置添加代码

	$options[] = array(
		'name' => '文章提醒信息',
		'desc' => '显示',
		'id' => 'remind_content',
		'class' => 'be_ico',
		'std' => '0',
		'type' => 'checkbox'
	);
 
	$options[] = array(
		'name' => '',
		'desc' => '超过几天提醒',
		'id' => 'remind_over_time',
		'class' => 'be_ico hidden',
		'std' => '365',
		'type' => 'text'
	);
 
	$options[] = array(
		'name' => '',
		'desc' => '提醒内容',
		'id' => 'remind_message',
		'class' => 'be_ico hidden',
		'std' => '如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!',
		'type' => 'text'
	);
 
	$options[] = array(
		'name' => '',
		'desc' => '提醒位置:文章顶部,默认提醒位置为文章底部',
		'id' => 'remind_position',
		'class' => 'be_ico hidden',
		'std' => '',
		'type' => 'checkbox'
	);
 
	$options[] = array(
		'name' => '',
		'desc' => '输入提醒的分类 ID,多个分类用英文半角逗号","隔开',
		'id' => 'remind_id',
		'class' => 'hidden',
		'std' => '',
		'type' => 'text'
	);
 
	$options[] = array(
		'id' => 'clear'
	);

然后:打开【/inc/options/includes/themes-options.php】文件,在适当位置添加代码

	jQuery('#remind_content').click(function() {
		jQuery('#section-remind_over_time, #section-remind_message, #section-remind_position, #section-remind_id, .remind-catid').fadeToggle(400);
	});
 
	if (jQuery('#remind_content:checked').val() !== undefined) {
		jQuery('#section-remind_over_time, #section-remind_message, #section-remind_position, #section-remind_id, .remind-catid').show();
	}

这段代码主要就是给上面的功能添加展开/闭合功能,当不启用该功能时,该功能下的选项将被隐藏。

接着:打开【/inc/inc.php】文件,在适当位置添加代码

// 文章提醒信息
if (zm_get_option('remind_content')) {
	function remind_content($content) {
		$modified_time = get_the_modified_time('U');
		$current_time = current_time('timestamp');
		$diff_time = ($current_time - $modified_time) / (60 * 60 * 24);
		$remind_over_time = zm_get_option('remind_over_time');
		if ($diff_time > $remind_over_time && in_category(explode(',',zm_get_option('remind_id'))) ) {
				if (zm_get_option('remind_position')) {
					$content = '<div class="remind_content">'.zm_get_option('remind_message').'</div>'. $content;
				} else {
					$content = $content.'<div class="remind_content">'.zm_get_option('remind_message').'</div>';
				}
		}
		return $content;
	}
	add_filter('the_content', 'remind_content');
}

最后:打开【style.css】文件,在适当位置添加代码

/* 文章提醒信息 */
.remind_content {
    color: #db7c22;
    background: #fffcef;
    border: 1px solid #ffbb76;
    border-radius: 2px;
    overflow: hidden;
    margin: 20px 0;
    padding: 10px 15px;
    font-size: 14px;
}

完成上面的操作后,在【主题选项】中找到该功能并启用,然后根据自己的情况设置相关的参数即可。

效果图:

以上就是爱游博客的一些改造,如有好的建议或是那里有问题,请在下方留言。

1 2 3 4 5 6 7 8 9 10 11 12 13
原文链接:https://www.vipiu.net/archives/2019/07/07/1944.html,转载请注明出处。
0

评论2

请先

  1. 面包屑导航美化少写了一个【width: 1122px;】
    匿名 2021-03-17 0
  2. 关注你期待你更多的美化效果
    匿名 2021-03-17 0
会员低至49元,开通享海量VIP资源免费下载 自助开通
显示验证码
没有账号?注册  忘记密码?