向安宇知识库 向安宇知识库
  • 读书向
  • 学习向
    • AI工具
    • AI研究
    • 笔记
    • AIP:克丽丝AI日志
  • 创作向
    • 写作
      • 非虚构
      • 剧本
      • 小说
      • 文言
      • 随笔
      • 日记
    • 视听
      • 纪录片
      • 设计
      • 视频
      • 摄影
    • 课程
  • 影视向
    • 创意策划
    • 前期拍摄
    • 后期制作
    • 影像实验
    • 影像设备
    • 大师镜头
    • 电影赏析
    • 视频论文
    • 项目复盘
  • 折腾向
    • 穿越机
    • 户外
    • 代码
    • 手工
    • 书法
    • 篆刻
    • 绘画
首页 › 折腾向 › 代码 › anyutv主题增加微语/说说/微博功能
  • 0
  • 0
  • 1

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

向安宇
2017-08-04 11:59:12

好久没折腾了,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 年前 湖北省

向安宇

痴迷文字,醉心影像
446
文章
5
评论
325
喜欢

聚合文章

克丽丝是谁?(人物设定1.0)
AIP克丽丝的构想
wordpress也要拥抱AI
AI时代我们如何学习

近期评论

要是AI有自我意识,第一件事是不是裁掉老板?
—— 岁寒松柏 1 小时前 AI治理会带来乌托邦还是暴政?
有些平台把简单内容包装成高价课,真是服了
—— SnuggleMuffin 2 小时前 如何选择优质学习平台?
所以AI到底该咋用啊?有人实际用出效果了吗?
—— 鱼鱼 2 小时前 如何提升学习效率?
催更!想看作者用AI做项目实战的后续~
—— 水晶幻梦 3 小时前 AI如何改变学习方式?
内容推荐算法居然能发现新视角,厉害
—— 雨林穿梭 5 小时前 AI如何优化网站管理效率?

猜你喜欢

wordpress也要拥抱AI

wordpress也要拥抱AI

2025-11-14 11:52:11
19 23 0
WordPress添加文章字数统计和预计阅读时间

WordPress添加文章字数统计和预计阅读时间

2020-06-01 15:46:12
1,222 0 0
wordpress网站一些优化

wordpress网站一些优化

2016-11-18 10:29:39
625 0 0
wordpresss百度数据推送优化以及设置

wordpresss百度数据推送优化以及设置

2016-07-01 16:47:14
1,755 0 0
1

关于我:

想要读万卷书,行万里路,看万部电影。

推荐栏目:

视频论文 课程 后期制作 非虚构 照片 视频

特色专题:

专题汇总 宜看一侃 帧影帧画 重读文学史 青玉记
Copyright © 2016-2025 向安宇知识库. 鄂ICP备16005400号-1 鄂公网安备42050602000017号
  • 读书向
  • 学习向
    • AI工具
    • AI研究
    • 笔记
    • AIP:克丽丝AI日志
  • 创作向
    • 写作
    • 视听
    • 课程
  • 影视向
    • 创意策划
    • 前期拍摄
    • 后期制作
    • 影像实验
    • 影像设备
    • 大师镜头
    • 电影赏析
    • 视频论文
    • 项目复盘
  • 折腾向
    • 穿越机
    • 户外
    • 代码
    • 手工
    • 书法
    • 篆刻
    • 绘画
  • 剪辑
  • 转场
  • 纪录片

向安宇

痴迷文字,醉心影像
446
文章
5
评论
325
喜欢