WordPress博客增加说说功能
把下边的代码加入到当前主题的functions.php 中
//新建说说功能
add_action('init', 'my_custom_init');
function my_custom_init()
{ $labels = array( 'name' => '说说',
'singular_name' => '说说',
'add_new' => '发表说说',
'add_new_item' => '发表说说',
'edit_item' => '编辑说说',
'new_item' => '新说说',
'view_item' => '查看说说',
'search_items' => '搜索说说',
'not_found' => '暂无说说',
'not_found_in_trash' => '没有已遗弃的说说',
'parent_item_colon' => '', 'menu_name' => '说说' );
$args = array( 'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'exclude_from_search' =>true,
'query_var' => true,
'rewrite' => true, 'capability_type' => 'post',
'has_archive' => false, 'hierarchical' => false,
'menu_position' => null,
'taxonomies'=> array('category','post_tag'),
'supports' => array('editor','author','title', 'custom-fields','comments') );
register_post_type('shuoshuo',$args);
}
添加PHP页面模板文件(说说模板1)
新建一个shuoshuo.php文件放到你正在使用的主题根目录pages文件夹里把下面代码放入shuoshuo.php<?php /*
Template Name: 说说碎语
*/
get_header(); ?>
<style type="text/css">
#shuoshuo_content {
background-color: #fff;
padding: 10px;
min-height: 500px;
}
/* shuo */
body.theme-dark .cbp_tmtimeline::before {
background: RGBA(255, 255, 255, 0.06);
}
ul.cbp_tmtimeline {
padding: 0;
}
div class.cdp_tmlabel > li .cbp_tmlabel {
margin-bottom: 0;
}
.cbp_tmtimeline {
margin: 30px 0 0 0;
padding: 0;
list-style: none;
position: relative;
}
/* The line */
.cbp_tmtimeline:before {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 4px;
background: RGBA(0, 0, 0, 0.02);
left: 80px;
margin-left: 10px;
}
/* The date/time */
.cbp_tmtimeline > li .cbp_tmtime {
display: block;
/* width: 29%; */
/* padding-right: 110px; */
max-width: 70px;
position: absolute;
}
.cbp_tmtimeline > li .cbp_tmtime span {
display: block;
text-align: right;
}
.cbp_tmtimeline > li .cbp_tmtime span:first-child {
font-size: 0.9em;
color: #bdd0db;
}
.cbp_tmtimeline > li .cbp_tmtime span:last-child {
font-size: 1.2em;
color: #9BCD9B;
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmtime span:last-child {
color: RGBA(255, 125, 73, 0.75);
}
div.cbp_tmlabel > p {
margin-bottom: 0;
}
/* Right content */
.cbp_tmtimeline > li .cbp_tmlabel {
margin: 0 0 45px 65px;
background: #9BCD9B;
color: #fff;
padding: .8em 1.2em .4em 1.2em;
/* font-size: 1.2em; */
font-weight: 300;
line-height: 1.4;
position: relative;
border-radius: 5px;
transition: all 0.3s ease 0s;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
cursor: pointer;
display: block;
}
.cbp_tmlabel:hover {
/* transform:scale(1.05); */
transform: translateY(-3px);
z-index: 1;
-webkit-box-shadow: 0 15px 32px rgba(0, 0, 0, 0.15) !important
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel {
background: RGBA(255, 125, 73, 0.75);
}
/* The triangle */
.cbp_tmtimeline > li .cbp_tmlabel:after {
right: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-right-color: #9BCD9B;
border-width: 10px;
top: 4px;
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after {
border-right-color: RGBA(255, 125, 73, 0.75);
}
p.shuoshuo_time {
margin-top: 10px;
border-top: 1px dashed #fff;
padding-top: 5px;
}
/* Media */
@media screen and (max-width: 65.375em) {
.cbp_tmtimeline > li .cbp_tmtime span:last-child {
font-size: 1.2em;
}
}
.shuoshuo_author_img img {
border: 1px solid #ddd;
padding: 2px;
float: left;
border-radius: 64px;
transition: all 1.0s;
}
.avatar {
-webkit-border-radius: 100% !important;
-moz-border-radius: 100% !important;
box-shadow: inset 0 -1px 0 #3333sf;
-webkit-box-shadow: inset 0 -1px 0 #3333sf;
-webkit-transition: 0.4s;
-webkit-transition: -webkit-transform 0.4s ease-out;
transition: transform 0.4s ease-out;
-moz-transition: -moz-transform 0.4s ease-out;
}
.zhuan {
transform: rotateZ(720deg);
-webkit-transform: rotateZ(720deg);
-moz-transform: rotateZ(720deg);
}
/* end */
</style>
</head>
<body>
<div id="primary" class="content-area" style="">
<main id="main" class="site-main" role="main">
<div id="shuoshuo_content">
<ul class="cbp_tmtimeline">
<?php query_posts("post_type=shuoshuo&post_status=publish&posts_per_page=-1");if (have_posts()) : while (have_posts()) : the_post(); ?>
<li> <span class="shuoshuo_author_img"><img src="https://www.XXXX.cn/wp-content/uploads/2017/03/5201314_avatar-96x96.jpg" class="avatar avatar-48" ></span>
<a class="cbp_tmlabel" href="javascript:void(0)">
<p></p>
<p><?php the_content(); ?></p>
<p></p>
<p class="shuoshuo_time"><i class="fa fa-clock-o"></i>
<?php the_time('Y年n月j日G:i'); ?>
</p>
</a>
<?php endwhile;endif; ?>
</li>
</ul>
</div>
</main>
<!-- .site-main -->
</div>
<script type="text/javascript">
$(function () {
var oldClass = "";
var Obj = "";
$(".cbp_tmtimeline li").hover(function () {
Obj = $(this).children(".shuoshuo_author_img");
Obj = Obj.children("img");
oldClass = Obj.attr("class");
var newClass = oldClass + " zhuan";
Obj.attr("class", newClass);
}, function () {
Obj.attr("class", oldClass);
})
})
</script>
<?php get_footer();?>
添加CSS样式(说说模板CSS样式1)
/* 说说css代码 */
#shuoshuo_content {
background-color: #fff;
padding: 10px;
min-height: 500px;
}
//说说
body.theme-dark .bsy_timeline::before {
background: RGBA(255, 255, 255, 0.06);
}
ul.bsy_timeline {
padding: 0;
}
div class.bsy_tmlabel > li .bsy_tmlabel {
margin-bottom: 0;
}
.bsy_timeline {
margin: 30px 0 0 0;
padding: 0;
list-style: none;
position: relative;
}
//时间
.bsy_timeline > li .bsy_tmtime {
display: block;
max-width: 70px;
position: absolute;
}
.bsy_timeline > li .bsy_tmtime span {
display: block;
text-align: rightright;
}
.bsy_timeline > li .bsy_tmtime span:first-child {
font-size: 0.9em;
color: #bdd0db;
}
.bsy_timeline > li .bsy_tmtime span:last-child {
font-size: 1.2em;
color: #9bcd9b;
}
.bsy_timeline > li:nth-child(odd) .bsy_tmtime span:last-child {
color: rgba(255, 125, 73, 0.75);
}
div.bsy_tmlabel > p {
margin-bottom: 0;
}
//说说内容
.bsy_timeline > li .bsy_tmlabel {
margin: 0 0 45px 65px;
background: #9bcd9b;
color: #fff;
padding: .8em 1.2em .4em 1.2em;
line-height: 1.4;
position: relative;
border-radius: 8px;
transition: all 0.3s ease 0s;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
display: block;
}
.bsy_tmlabel:hover {
transform: translateY(-3px);
z-index: 1;
-webkit-box-shadow: 0 15px 32px rgba(0, 0, 0, 0.15) !important
}
.bsy_timeline > li:nth-child(odd) .bsy_tmlabel {
background: rgba(255, 125, 73, 0.75);
}
//三角
.bsy_timeline > li .bsy_tmlabel:after {
rightright: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-right-color: #9bcd9b;
border-width: 10px;
top: 10px;
}
.bsy_timeline > li:nth-child(odd) .bsy_tmlabel:after {
border-right-color: rgba(255, 125, 73, 0.75);
}
.shuoshuo_time {
margin-top: 10px;
border-top: 1px dashed #eaeaea;
padding-top: 6px;
}
//头像
@media screen and (max-width: 65em) {
.bsy_timeline > li .bsy_tmtime span:last-child {
font-size: 1.3em;
}
}
.author_tou img {
border: 1px solid #ccc;
padding: 2px;
float: left;
border-radius: 8px;
transition: all 1.0s;
}
.zhuan {
transform: rotateZ(720deg);
-webkit-transform: rotateZ(720deg);
-moz-transform: rotateZ(720deg);
}
添加PHP页面模板文件(说说模板2)-这是第二个说说页面与上面的样式不一样。
新建一个shuoshuo2.php文件放到你正在使用的主题根目录pages文件夹里把下面代码放入shuoshuo2.php<?php
/* Template Name: 说说/心情 */
get_header();
?>
<!-- <section class="container"> -->
<div class="content-wrap">
<div class="content">
<div style="background: #FFF; padding: 30px; border-radius: 5px;">
<ul class="cbp_tmtimeline">
<?php
query_posts("post_type=shuoshuo & post_status=publish & posts_per_page=-1");
if ( have_posts() ) {
while ( have_posts() ) {
the_post(); ?>
<li>
<time class="cbp_tmtime"><i class="fa fa-clock-o"></i> <?php the_time('Y年n月j日G:i'); ?></time>
<div class="cbp_tmicon">
<img src="头像链接" class="avatar avatar-48" >
</div>
<div class="cbp_tmlabel" >
<span style="font-size:18px;"><?php the_content(); ?></span>
<span style="font-size:14px;"><i class="fa fa-clock-o"></i> <?php the_time('Y-n-j-G:i'); ?></span>
<h2><?php the_title(); ?><span><?php echo get_bloginfo('name'); ?> - <?php echo get_bloginfo('description' ); ?></span></h2>
</div>
</li>
<?php }
} ?>
</ul>
</div>
<?php get_footer();?>
添加CSS样式(说说模板CSS样式2)
/** 垂直时间线CSS样式 */
.cbp_tmtimeline {
margin: 30px 0 0 0;
padding: 0;
list-style: none;
position: relative;
}
/* The line */
.cbp_tmtimeline:before {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 10px;
background: #afdcf8;
left: 20%;
margin-left: -6px;
}
/* The date/time */
.cbp_tmtimeline > li .cbp_tmtime {
display: block;
width: 30%;
padding-right: 100px;
position: absolute;
color: #AAA;
}
.cbp_tmtimeline > li .cbp_tmtime span {
display: block;
text-align: right;
}
.cbp_tmtimeline > li .cbp_tmtime span:first-child {
font-size: 0.9em;
color: #bdd0db;
}
.cbp_tmtimeline > li .cbp_tmtime span:last-child {
font-size: 2.9em;
color: #24a0f0;
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmtime span:last-child {
color: #7878f0;
}
/* Right content */
.cbp_tmtimeline > li .cbp_tmlabel {
margin: 0 0 15px 25%;
background: #24a0f0;
color: #fff;
padding: 0.8em;
font-size: 1.2em;
font-weight: 300;
line-height: 1.4;
position: relative;
border-radius: 5px;
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel {
background: #7878f0;
}
.cbp_tmtimeline > li .cbp_tmlabel h2 {
border-bottom: 0px;
border-top:1px dashed #FFF;
font-size:16px;
height: 24px;
padding: 5px 3px 12px;
margin:0px;
}
.cbp_tmtimeline > li .cbp_tmlabel h2 > span {
font-size: 12px;
float: right;
text-align: center;
line-height: 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The triangle */
.cbp_tmtimeline > li .cbp_tmlabel:after {
right: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-right-color: #24a0f0;
border-width: 10px;
top: 10px;
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after {
border-right-color: #7878f0;
}
/* The icons */
.cbp_tmtimeline > li .cbp_tmicon {
width: 48px;
height: 48px;
font-family: 'ecoico';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
font-size: 48px;
line-height: 48px;
-webkit-font-smoothing: antialiased;
position: relative;
color: #fff;
background: #46a4da;
border-radius: 50%;
box-shadow: 0 0 0 8px #afdcf8;
text-align: center;
left: 20%;
top: 0;
margin: 0 0 0 -25px;
}
.cbp_tmtimeline > li .cbp_tmicon >img {
border-radius: 50%;
position: absolute;
top: 0px;
left: 0px;
}
/* Example Media Queries */
@media screen and (max-width: 65.375em) {
.cbp_tmtimeline > li .cbp_tmtime span:last-child {
font-size: 1.5em;
}
}
@media screen and (max-width: 47.2em) {
.cbp_tmtimeline:before {
display: none;
}
.cbp_tmtimeline > li .cbp_tmtime {
width: 100%;
position: relative;
padding: 0 0 20px 0;
}
.cbp_tmtimeline > li .cbp_tmtime span {
text-align: left;
}
.cbp_tmtimeline > li .cbp_tmlabel {
margin: 0 0 30px 0;
padding: 1em;
font-weight: 400;
font-size: 95%;
}
.cbp_tmtimeline > li .cbp_tmlabel:after {
right: auto;
left: 20px;
border-right-color: transparent;
border-bottom-color: #24a0f0;
top: -20px;
}
.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after {
border-right-color: transparent;
border-bottom-color: #7878f0;
}
.cbp_tmtimeline > li .cbp_tmicon {
position: relative;
float: right;
left: auto;
margin: -55px 5px 0 0px;
}
}
后续说明
如果只想单纯的写文字的话,可以把第15行代码中的<?php the_content(); ?>改成<?php the_title(); ?>,这样发表说说只要填写标题就可以了,查找起来也比较方便。如果用<?php the_content(); ?>,那么发表说说的时候标题和内容要写成一样,方便查找,如果只填写内容,那么在后台查看说说的时候,显示的列表全是无标题,对于修改比较麻烦。 注意上面代码第147行处是你头像的地址,修改即可!fa fa-clock-o
此为时间前图标如不显示请自行更改。阿里图标库。发布说说
以上步骤完成后,进入 WordPress 后台,新建“说说”页面,模版选择之前创建的“说说”模版,之后就可以在后台发表说说了。WordPress博客增加微语功能
把下边的代码加入到当前主题的functions.php 中
//新建微语功能
add_action('init', 'my_shuoshuo');
function my_shuoshuo()
{ $labels = array( 'name' => '微语',
'singular_name' => '微语',
'add_new' => '发表微语',
'add_new_item' => '发表微语',
'edit_item' => '编辑微语',
'new_item' => '新微语',
'view_item' => '查看微语',
'search_items' => '搜索微语',
'not_found' => '暂无微语',
'not_found_in_trash' => '没有已遗弃的微语',
'parent_item_colon' => '', 'menu_name' => '微语' );
$args = array( 'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'exclude_from_search' =>true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true, 'hierarchical' => false,
'menu_position' => null, 'supports' => array('editor','author','title','comments') );
register_post_type('weiyu',$args);
}
添加PHP文件
新建一个weiyu.php文件放到你正在使用的主题根目录pages文件夹里把下面代码放入weiyu.php<?php
/*
Template Name: 微言微语
*/
?>
<?php get_header(); ?>
<style type="text/css">
.weiyu-header h1 {
font-size: 12px;
font-size: 1.6rem;
line-height: 30px;
text-align: center;
margin: 0 0 15px 0;
}
.weiyu-title {
font-size: 13px;
margin: 10px -21px 10px -21px;
padding: 0 15px;
border-bottom: 1px solid #ebebeb;
border-left: 5px solid #0088cc;
}
</style>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="weiyu-header">
<h1 class="single-title"><?php the_title(); ?></h1>
<h3 class="weiyu-title">目前有 <?php $count_posts = wp_count_posts('weiyu'); echo $published_posts = $count_posts->publish;?> 个微语,于<?php $last = $wpdb->get_results("SELECT MAX(post_modified) AS MAX_m FROM $wpdb->posts WHERE (post_type = 'weiyu')");$last = date('Y年n月j日', strtotime($last[0]->MAX_m));echo $last; ?>更新。
</h3>
</header>
<main id="main" class="site-main" role="main">
<!--noptimize-->
<div class="weiyu">
<ul class="archives-monthlisting">
<?php $limit = get_option('posts_per_page');$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;query_posts('post_type=weiyu&post_status=publish&showposts=' . $limit=15 . '&paged=' . $paged);if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><?php echo get_avatar( get_the_author_email(), 40 ); ?>
<div class="calendar-year">
<div class="cal-year"><?php echo get_the_time('y') ?></div>
</div>
<div class="calendar">
<div class="cal-month month-<?php echo get_the_time('m') ?>"><?php echo get_the_time('M') ?></div>
<div class="cal-date"><?php echo get_the_time('j') ?></div>
</div><em></em>
<div class="weiyu-content"><?php the_content(); ?><br/><div class="weiyu-meta"><span><i class="fa fa-user-circle"></i>:<?php the_author() ?> <a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" title="<?php _e( '点赞', 'begin' ); ?>" class="dingzan<?php if(isset($_COOKIE['zm_like_'.$post->ID])) echo ' done';?>"><i class="fa fa-thumbs-o-up"></i>:(<i class="count"><?php if( get_post_meta($post->ID,'zm_like',true) ){
echo get_post_meta($post->ID,'zm_like',true);
} else {
echo '0';
}?></i>)</a></span></div>
</div>
<?php endwhile;endif; ?>
</li>
</ul>
</div>
<!--/noptimize-->
</main><!-- .site-main -->
</article><!-- #page -->
<?php begin_pagenav(); ?>
<?php get_footer(); ?>
添加CSS样式
需要注意的是代码中/*波浪线*/bolangxian.png路径注意修改成自己的/*微语*/
strong { font-weight: normal;}
.weiyu {
position: relative;
padding: 10px 0;
}
.weiyu li {
padding: 8px 0;
display: block;
}
.weiyu-content {
box-shadow: 0 0 3px RGBA(0,0,0,.15);
background-color: #f9f9f9;
border:1px #ccc solid;
border-radius: 4px;
font-size: 1.0em;
line-height:1.5em;
margin:0 150px 0 150px;
letter-spacing: 1px;
padding: 20px 20px 0px 30px;
color: #666;
min-height:60px;
position: relative;
white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
word-wrap: break-word; /* IE 5+, 文本行的任意字内断开 */
}
.weiyu-content p{margin:0;}
/*作者*/
.weiyu-meta {text-align: right;letter-spacing: 0px;margin-top:-15px;}
.weiyu-meta span{background-color:#f9f9f9;border-radius:3px;padding:2px 5px;font-size:13px}
.weiyu-meta a {color: #666 !important;}
/*年月日*/
.calendar{text-align:center;position:relative;margin-bottom:5px;margin-right:-5px;margin-top:0;border:1px solid #c9c9c9;-webkit-border-top-left-radius:7px;-webkit-border-bottom-right-radius:7px;border-radius-topleft:7px;border-radius-bottomright:7px;border-top-left-radius:7px;border-bottom-right-radius:7px;-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;top:20px;float:left;margin-left: 3px;-webkit-box-shadow:#c6c6c6 1px 1px 3px;box-shadow:#c6c6c6 1px 1px 3px}
.calendar-year{text-align:center;position:relative;margin-bottom:5px;margin-right:-5px;margin-top:0;border:1px solid #c9c9c9;-webkit-border-top-left-radius:7px;border-bottom-left-radius:7px;top:39px;float:left;margin-left: 27px;}
.cal-year{color:#b2b1b2;background-color:#e9e9e9;text-shadow:white -1px -1px 1px;-webkit-border-top-left-radius:6px;border-radius-bottomleft:6px;border-bottom-left-radius:6px;letter-spacing:-2px;font:bold 15px Helvetica,"Arial Rounded MT Bold",Geneva,sans-serif;padding:1px 4px 2px 0;text-align:center;border:1px solid #fff}
.cal-month{-webkit-border-top-left-radius:6px;border-radius-topleft:6px;border-top-left-radius:6px;font-size:10px;font-weight:bold;color:#fff;letter-spacing:0;text-transform:uppercase;padding:3px 10px}
.cal-date{color:#222;background-color:#e9e9e9;text-shadow:white -1px -1px 1px;-webkit-border-bottom-right-radius:6px;border-radius-bottomright:6px;border-bottom-right-radius:6px;letter-spacing:-2px;font:bold 21px Helvetica,"Arial Rounded MT Bold",Geneva,sans-serif;padding:1px 4px 2px 0;text-align:center;border:1px solid #fff}
.month-01{background-color:#767c8f}.month-02{background-color:#345abe}.month-03{background-color:#37838d}.month-04{background-color:#55b06c}.month-05{background-color:#409ad5}.month-06{background-color:#be63c5}
.month-07{background-color:#f79445}.month-08{background-color:#4e1e00}.month-09{background-color:#a04262}.month-10{background-color:#284461}.month-11{background-color:#4d1d77}.month-12{background-color:#af1919}
/*波浪线*/
.weiyu li em{float:left;background:url("bolangxian.png") no-repeat;width:55px;height:10px;margin:42px 0 0 26px;}
/*头像*/
.weiyu .avatar{border-radius: 50%;margin: 26px 35px 0 5px;float:right;padding: 0px;border: 1px #ddd solid;display: block;transition: .5s;width: 40px;height: 40px;overflow:hidden;}
.weiyu li:hover .avatar {
transform: rotate(360deg);-webkit-transform: rotate(720deg);-moz-transform: rotate(720deg);border-color: #0c0;}
/*前面的轴*/
.weiyu:before {
height: 100%;
width: 2px;
background: #eee;
position: absolute;
left: 105px;
content: "";
top:0px;
}
.weiyu-content:before {
position: absolute;
top: 40px;
bottom: 0px;
left: -51px;
background: #fff;
height: 12px;
width: 12px;
border-radius: 6px;
content: "";
box-shadow: inset 0 0 2px #0c0;
}
.weiyu-content:after {
position: absolute;
top: 42px;
bottom: 0px;
left: -49px;
background: #ccc;
height: 8px;
width: 8px;
border-radius: 6px;
content: "";
}
.weiyu li:hover .weiyu-content:after {
background: #0c0;
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
-ms-transform: scale(1.3);
-o-transform: scale(1.3);
}
.weiyu li:hover .weiyu-content:before {-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
-ms-transform: scale(1.3);
-o-transform: scale(1.3);}
/*后面的轴*/
.weiyu:after {
height: 100%;
width: 2px;
background: #eee;
position: absolute;
right: 100px;
content: "";
top:0px;
}
.weiyu-meta:before {
position: absolute;
top: 42px;
bottom: 0px;
right: -56px;
background: #fff;
height: 12px;
width: 12px;
border-radius: 6px;
content: "";
z-index:2;
box-shadow: inset 0 0 2px #0c0;
}
.weiyu-meta:after {
position: absolute;
top: 44px;
bottom: 0px;
right: -54px;
background: #ccc;
height: 8px;
width: 8px;
z-index:2;
border-radius: 6px;
content: "";
}
.weiyu li:hover .weiyu-meta:after {
background: #0c0;
}
@media screen and (max-width: 550px) {
.weiyu-content {margin:0 30px 0 30px;padding: 10px 3px 0px 8px;font-size:0.9em;}
.calendar{left: -46px;top:8px;margin-right:-46px;}
.cal-month{font-size:8px;padding:0px 3px}
.cal-date{font:bold 13px Helvetica,"Arial Rounded MT Bold",Geneva,sans-serif;}
.calendar-year{left: -46px;top:26px;}
.cal-year{font:bold 9px Helvetica,"Arial Rounded MT Bold",Geneva,sans-serif;padding:0 1px 0 0;}
.weiyu:before {left: 20px;}
.weiyu-content:before {left: -16px;top:25px;}
.weiyu-content:after {left: -14px;top:27px;}
.weiyu:after {right: 20px;}
.weiyu-meta:before {right: -16px;top:25px;}
.weiyu-meta:after {right: -14px;top:27px;}
.weiyu .avatar{margin: 16px -17px 0 5px;width: 30px;height: 30px;}
.weiyu li em{float:left;width:10px;height:10px;margin:25px 0 0 -12px;}
.weiyu-meta span{font-size:10px}
}
【注意事项】
这个微语页面使用了Font Awesome字体图标,需要安装font awesome 4 menus插件(或者直接将Font Awesome字体放到网站目录下)才能正常显示。或自行修改成Iconfont-阿里巴巴矢量图标库的也可以,看自己选择。weiyu.php文件内2段图标可自行修改(fa fa-user-circle)(fa fa-thumbs-o-up)发布微语
以上步骤完成后,进入 WordPress 后台,新建“微语”页面,模版选择之前创建的“微语”模版,之后就可以在后台发表微语了。 声明:本站文章原创有部分资源来源于网络,如无特殊说明或标注。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系 admin@liitk.com 进行删除处理!。
评论(0)