Ripro主题美化-给Ripro主题增加说说、微博的时间轴微语页面

导读

图片[1]-Ripro主题美化-给Ripro主题增加说说、微博的时间轴微语页面-MC百科

使用方法

1、把下面代码复制粘贴到主题里的functions.php函数文件中,为WordPress添加微语功能,完成后便可在WP后台菜单中找到“微语”这一项。

//新建微语功能 www.mcbke.com  https://www.mcbke.com/riprozt-tjwyym.html 
    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);
    }

2、新建一个template-weiyu.php文件,将下面代码复制进去,上传到主题里的pages目录层级中。

[wm_login]


    
                    


[/wm_login]

CSS样式美化

[erphpdown][wm_login]

/*微语*/
    strong { font-weight: normal;}
    .weiyu {
    position: relative;
    padding: 10px 0;
	width:1400px;
	left:12%;
    }

    .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}
    }

[/wm_login][/erphpdown]

注意事项

这个微语页面使用的是阿里巴巴矢量图标库,需要自行修改成Iconfont-阿里巴巴矢量图标库才可以显示。也可以安装font awesome 4 menus插件(或者直接将Font Awesome字体放到网站目录下),这个看个人的使用习惯。
template-weiyu.php文件内2段图标可自行修改
[v_tips]
zm zm-user-circle
zm zm-thumbs-o-up[/v_tips]
[dm href=’/weiyu’]演示效果[/dm]

温馨提示:本文最后更新于2021-08-18 10:43:09,某些文章具有时效性,若有错误或已失效,请在下方留言或联系MC百科网
© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发
MC百科的头像-MC百科

昵称

取消
昵称表情代码图片
我也是有底线哒~

斜谷之川,其泽楠隆