讲故事的手艺人 讲故事的手艺人
  • 创作向
    • 写作
      • 非虚构
      • 剧本
      • 小说
      • 文言
      • 读书
      • 随笔
    • 拍摄
      • 纪录片
      • 设计
      • 视频
      • 摄影
  • 策划向
    • 策划资料
    • 创意之道
    • 短视频研究
  • 技术向
    • AI
    • 前期拍摄
    • 后期制作
    • 原创教程
    • 影像实验
    • 影像设备
    • 穿越机
  • 艺术向
    • 研究学习
    • 大师镜头
    • 电影赏析
    • 视频论文
    • 经验总结
  • 注册
  • 登录
首页 › 折腾 › 代码 › anyutv主题增加微语/说说/微博功能

anyutv主题增加微语/说说/微博功能

向安宇
2017-08-04 11:59:12代码阅读 1,285

好久没折腾了,ECS用的又拍云之后经常数据库出错,干脆没用了……服务器折腾的烦心,偶尔折腾下主题吧。

早上看片子有点儿想法,一两句想纪录下来,又不想单独发一篇文章,还要放在一起方便查看,也就是一个笔记的功能,随时随地记录一些碎片化的想法。

于是就给 anyu.tv 增加一个小功能,想到了“说说”功能,稍微改了一下。

一、首先在functions.php 里加上代码:

  1. //新建笔记功能   
  2. add_action('init', 'my_custom_init');  
  3. function my_custom_init()  
  4. { $labels = array( 'name' => '笔记',  
  5. 'singular_name' => '笔记',  
  6. 'add_new' => '发表笔记',  
  7. 'add_new_item' => '发表笔记',  
  8. 'edit_item' => '编辑笔记',  
  9. 'new_item' => '新笔记',  
  10. 'view_item' => '查看笔记',  
  11. 'search_items' => '搜索笔记',  
  12. 'not_found' => '暂无笔记',  
  13. 'not_found_in_trash' => '没有已遗弃的笔记',  
  14. 'parent_item_colon' => '', 'menu_name' => '笔记' );  
  15. $args = array( 'labels' => $labels,  
  16. 'public' => true,  
  17. 'publicly_queryable' => true,  
  18. 'show_ui' => true,  
  19. 'show_in_menu' => true,  
  20. 'exclude_from_search' =>true,  
  21. 'query_var' => true,  
  22. 'rewrite' => true, 'capability_type' => 'post',  
  23. 'has_archive' => false, 'hierarchical' => false,  
  24. 'menu_position' => null, 'supports' => array('editor','author','title', 'custom-fields') );  
  25. register_post_type('shuoshuo',$args);  
  26. }  

二、新建一个shuoshuo.php放在主题根目录,并写入:

  1.     <?php  get_header(); ?>  
  2.     <style type="text/css">  
  3.         #shuoshuo_content {  
  4.             background-color: #fff;  
  5.             box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);  
  6.             padding: 10px;  
  7.             min-height: 500px;  
  8.         }  
  9.         /* shuo */  
  10.         body.theme-dark .cbp_tmtimeline::before {  
  11.             background: RGBA(255, 255, 255, 0.06);  
  12.         }  
  13.         ul.cbp_tmtimeline {  
  14.             padding: 0;  
  15.         }  
  16.         div class.cdp_tmlabel > li .cbp_tmlabel {  
  17.             margin-bottom: 0;  
  18.         }  
  19.         .cbp_tmtimeline {  
  20.             margin: 30px 0 0 0;  
  21.             padding: 0;  
  22.             list-style: none;  
  23.             position: relative;  
  24.         }  
  25.         /* The line */  
  26.         .cbp_tmtimeline:before {  
  27.             content: '';  
  28.             position: absolute;  
  29.             top: 0;  
  30.             bottom: 0;  
  31.             width: 4px;  
  32.             background: RGBA(0, 0, 0, 0.02);  
  33.             left: 80px;  
  34.             margin-left: 10px;  
  35.         }  
  36.         /* The date/time */  
  37.         .cbp_tmtimeline > li .cbp_tmtime {  
  38.             display: block;  
  39.             width: 29%;   
  40.             /* padding-right: 110px;*/  
  41.             max-width: 70px;  
  42.             position: absolute;  
  43.         }  
  44.         .cbp_tmtimeline > li .cbp_tmtime span {  
  45.             display: block;  
  46.             text-align: right;  
  47.         }  
  48.         .cbp_tmtimeline > li .cbp_tmtime span:first-child {  
  49.             font-size: 0.5em;  
  50.             color: #bdd0db;  
  51.         }  
  52.         .cbp_tmtimeline > li .cbp_tmtime span:last-child {  
  53.             font-size: 1.2em;  
  54.             color: #9BCD9B;  
  55.         }  
  56.         .cbp_tmtimeline > li:nth-child(odd) .cbp_tmtime span:last-child {  
  57.             color: RGBA(255, 125, 73, 0.75);  
  58.         }  
  59.         div.cbp_tmlabel > p {  
  60.             margin-bottom: 0;  
  61.         }  
  62.         /* Right content */  
  63.         .cbp_tmtimeline > li .cbp_tmlabel {  
  64.             margin: 0 0 45px 65px;  
  65.             background: #9BCD9B;  
  66.             color: #fff;  
  67.             padding: .8em 1.2em .4em 1.2em;  
  68.             font-size: 1.2em;   
  69.             text-decoration:none;   
  70.             font-weight: 300;  
  71.             line-height: 1.4;  
  72.             position: relative;  
  73.             border-radius: 5px;  
  74.             transition: all 0.3s ease 0s;  
  75.             box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);  
  76.             cursor: pointer;  
  77.             display: block;  
  78.         }  
  79.         .cbp_tmlabel:hover {  
  80.             transform:scale(1.05);   
  81.             transform: translateY(-3px);  
  82.             z-index: 1;  
  83.             -webkit-box-shadow: 0 15px 32px rgba(0, 0, 0, 0.15) !important  
  84.         }  
  85.         .cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel {  
  86.             background: RGBA(255, 125, 73, 0.75);  
  87.         }  
  88.         /* The triangle */  
  89.         .cbp_tmtimeline > li .cbp_tmlabel:after {  
  90.             right: 100%;  
  91.             border: solid transparent;  
  92.             content: " ";  
  93.             height: 0;  
  94.             width: 0;  
  95.             position: absolute;  
  96.             pointer-events: none;  
  97.             border-right-color: #9BCD9B;  
  98.             border-width: 10px;  
  99.             top: 4px;  
  100.         }  
  101.         .cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after {  
  102.             border-right-color: RGBA(255, 125, 73, 0.75);  
  103.         }  
  104.         p.shuoshuo_time {  
  105.             margin-top: 10px;  
  106.             border-top: 1px dashed #fff;  
  107.             padding-top: 5px;  
  108.         }  
  109.         /* Media */  
  110.         @media screen and (max-width: 65.375em) {  
  111.             .cbp_tmtimeline > li .cbp_tmtime span:last-child {  
  112.                 font-size: 1.2em;  
  113.             }  
  114.         }  
  115.         .shuoshuo_author_img img {  
  116.             border: 1px solid #ddd;  
  117.             padding: 2px;  
  118.             float: left;  
  119.             border-radius: 64px;  
  120.             transition: all 1.0s;  
  121.         }  
  122.         .avatar {  
  123.             -webkit-border-radius: 100% !important;  
  124.             -moz-border-radius: 100% !important;  
  125.             box-shadow: inset 0 -1px 0 #3333sf;  
  126.             -webkit-box-shadow: inset 0 -1px 0 #3333sf;  
  127.             -webkit-transition: 0.4s;  
  128.             -webkit-transition: -webkit-transform 0.4s ease-out;  
  129.             transition: transform 0.4s ease-out;  
  130.             -moz-transition: -moz-transform 0.4s ease-out;  
  131.         }  
  132.         .zhuan {  
  133.             transform: rotateZ(720deg);  
  134.             -webkit-transform: rotateZ(720deg);  
  135.             -moz-transform: rotateZ(720deg);  
  136.         }  
  137.         /* end */  
  138.     </style>  
  139.     </head>  
  140.     <body>  
  141.     <div id="primary" class="content-area" style="">  
  142.         <main id="main" class="site-main" role="main">  
  143.             <div id="shuoshuo_content">  
  144.                 <ul class="cbp_tmtimeline">  
  145.                     <?php query_posts("post_type=shuoshuo&post_status=publish&posts_per_page=-1");if (have_posts()) : while (have_posts()) : the_post(); ?>  
  146.                     <li> <span class="shuoshuo_author_img"><img src="https://anyu.tv/wp-content/uploads/cropped-圆版.png" class="avatar avatar-48" width="48" height="48"></span>  
  147.                         <a class="cbp_tmlabel" href="javascript:void(0)">  
  148.                             <p></p>  
  149.                             <p><?php the_content(); ?></p>  
  150.                             <p></p>  
  151.                             <p class="shuoshuo_time"><i class="fa fa-clock-o"></i>  
  152.                                 <?php the_time('Y年n月j日G:i'); ?>  
  153.                             </p>  
  154.                         </a>  
  155.                         <?php endwhile;endif; ?>  
  156.                     </li>  
  157.                 </ul>  
  158.             </div>  
  159.         </main>  
  160.         <!-- .site-main -->  
  161.     </div>  
  162.     <script type="text/javascript">  
  163.         $(function () {  
  164.             var oldClass = "";  
  165.             var Obj = "";  
  166.             $(".cbp_tmtimeline li").hover(function () {  
  167.                 Obj = $(this).children(".shuoshuo_author_img");  
  168.                 Obj = Obj.children("img");  
  169.                 oldClass = Obj.attr("class");  
  170.                 var newClass = oldClass + " zhuan";  
  171.                 Obj.attr("class", newClass);  
  172.             }, function () {  
  173.                 Obj.attr("class", oldClass);  
  174.             })  
  175.         })  
  176.     </script>  
  177. <?php get_footer(); ?>  

anyu.tv用的主题是我拿国外主题改的,这个说说的css样式不知道哪里抽疯总是有下划线,一气之下干脆加里一行代码暴力解决:

  1. text-decoration:none;   

把文本样式全给去掉了。

三、新建页面,选择说说模板

访问这个页面就是“笔记”(说说)的网页了。

这算是私人笔记,没有给访问入口,只能通过网址访问:https://anyu.tv/biji

wordpress
赞赏 赞(0) 收藏(0)
《降临》在命运之巅
上一篇
《弧线》的美 ——读顾城的《弧线》
下一篇

请登录以参与评论

现在登录
所有评论(1)
  • UEDshare

    拍得了电影,写得了代码,漂亮

    8年前 湖北省 回复
标签
720全景 ACES AE AE案例 AE表达式 Anyu翻译 CSC电影学院 fusion Hackintosh MG动画 ps教程 vlog wordpress 创意方法 剪辑 字幕 帧影帧画 抖音 摄影 文案 混剪 混音 灯光 看电影 磨皮 穿越机 纪录片 编剧 美术 美食 論語 调度 调色 达芬奇 重讀文學史 青玉记
腾讯云轻量应用服务器搭建wordpress
2021-11-13 21:36:45
848 0 0
301跳转:http跳转https不带www跳转到带www
2021-10-13 21:49:09
777 0 0
WordPress添加文章字数统计和预计阅读时间
2020-06-01 15:46:12
1,162 0 0
笨办法用腾讯云视频搭建wordpress低频使用的自适应码流视频播放器
2020-05-23 21:00:44
2,740 0 0
1
  • 0
  • 1
关于我:

想要读万卷书,行万里路,看万部电影。当过人民教师,做过策划师,入行影视做剪辑、导演。艺术是目的,技术是支撑,不断钻研,积聚梦想,同时分享干货。

推荐栏目:
视频论文 原创教程 后期制作 非虚构 照片 视频
特色专题:
专题汇总 宜看一侃 帧影帧画 美食摄影 重读文学史 青玉记
Copyright © 2016-2025 讲故事的手艺人. 鄂ICP备16005400号-1 鄂公网安备42050602000017号
  • 创作向
    • 写作
    • 拍摄
  • 策划向
    • 策划资料
    • 创意之道
    • 短视频研究
  • 技术向
    • AI
    • 前期拍摄
    • 后期制作
    • 原创教程
    • 影像实验
    • 影像设备
    • 穿越机
  • 艺术向
    • 研究学习
    • 大师镜头
    • 电影赏析
    • 视频论文
    • 经验总结
# 剪辑 # # 转场 # # 纪录片 #
向安宇
痴迷文字,醉心影像
420
文章
5
评论
325
喜欢