{"id":171,"date":"2020-05-21T13:33:57","date_gmt":"2020-05-21T05:33:57","guid":{"rendered":"https:\/\/www.cuishaofeng.com\/?p=171"},"modified":"2024-10-22T14:45:45","modified_gmt":"2024-10-22T06:45:45","slug":"wordpress%e6%b7%bb%e5%8a%a0%e8%af%b4%e8%af%b4-%e5%bf%83%e6%83%85%e9%a1%b5%e9%9d%a2","status":"publish","type":"post","link":"https:\/\/www.cuishaofeng.com\/?p=171","title":{"rendered":"WordPress\u6dfb\u52a0\u8bf4\u8bf4\/\u5fc3\u60c5\u9875\u9762"},"content":{"rendered":"<div id=\"core-ai-summary-tool\"><\/div>\n<p>\u5f88\u591a\u7f51\u7ad9\u90fd\u6709\u4e00\u4e2a\u8bf4\u8bf4\/\u5fc3\u60c5\u7684\u9875\u9762\uff0c\u7528\u6765\u8bb0\u5f55\u81ea\u5df1\u6bcf\u65e5\u7684\u6240\u601d\u6240\u60f3\uff0c\u5f88\u662f\u4e0d\u9519\u3002\u81ea\u5df1\u4e4b\u524d\u90fd\u662f\u5c06\u81ea\u5df1\u7684\u5fc3\u60c5\u8bb0\u5f55\u5728\u6dfb\u52a0\u6298\u817e\u4e2a\u8bf4\u8bf4\/\u5fc3\u60c5\u7684\u9875\u9762\uff0c\u4ece\u7f51\u4e0a\u641c\u7d22\u4e86\u76f8\u5173\u6587\u7ae0\uff1b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6ce8\u518c\u5e16\u5b50\u7c7b\u578b<\/h3>\n\n\n\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528 WordPress \u7684\u00a0register_post_type( )\u00a0\u51fd\u6570\u6ce8\u518c\u4e00\u4e2a\u65b0\u7684\u5e16\u5b50\u7c7b\u578b\uff0c\u4ee5\u65b9\u4fbf\u65e5\u540e\u7f16\u8f91\u8bf4\u8bf4\u3002\u5c06\u4ee5\u4e0b\u4ee3\u7801\u76f4\u63a5\u4e22\u5230\u4e3b\u9898\u7684 functions.php \u6587\u4ef6\u4e2d\u53bb\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u8bf4\u8bf4\nadd_action(\u2018init\u2019, \u2018my_custom_shuoshuo_init\u2019);\nfunction my_custom_shuoshuo_init() { \n    $labels = array( \n        'name' => '\u8bf4\u8bf4',\n        'singular_name' => '\u8bf4\u8bf4', \n        'all_items' => '\u6240\u6709\u8bf4\u8bf4',\n        'add_new' => '\u53d1\u8868\u8bf4\u8bf4', \n        'add_new_item' => '\u64b0\u5199\u65b0\u8bf4\u8bf4',\n        'edit_item' => '\u7f16\u8f91\u8bf4\u8bf4', \n        'new_item' => '\u65b0\u8bf4\u8bf4', \n        'view_item' => '\u67e5\u770b\u8bf4\u8bf4', \n        'search_items' => '\u641c\u7d22\u8bf4\u8bf4', \n        'not_found' => '\u6682\u65e0\u8bf4\u8bf4', \n        'not_found_in_trash' => '\u6ca1\u6709\u5df2\u9057\u5f03\u7684\u8bf4\u8bf4', \n        'parent_item_colon' => '',\n        'menu_name' => '\u8bf4\u8bf4'\n    ); \n    $args = array( \n        'labels' => $labels, \n        'public' => true, \n        'publicly_queryable' => true, \n        'show_ui' => true, \n        'show_in_menu' => true, \n        'query_var' => true, \n        'rewrite' => true, \n        'capability_type' => 'post', \n        'has_archive' => true, \n        'hierarchical' => false, \n        'menu_position' => null, \n        'supports' => array('title','editor','author') \n    ); \nregister_post_type('shuoshuo',$args); \n}<\/code><\/pre>\n\n\n\n<p>\u770b\u5230\u535a\u4e3b\u6587\u5b57\u5496\u5f15\u7528\u7684\u4ee3\u7801\u7f3a\u5c11\u4e00\u4e0b\uff0c\u8fd9\u91cc\u8865\u5145\u4e00\u4e0b\u65b9\u80fd\u5728\u9875\u9762\u4e2d\u663e\u793a\u8bf4\u8bf4\u529f\u80fd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u8bf4\u8bf4\nadd_action(\u2018init\u2019, \u2018my_custom_shuoshuo_init\u2019);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u6dfb\u52a0\u8bf4\u8bf4\/\u5fc3\u60c5\u9875\u9762\u6a21\u677f\u6587\u4ef6<\/h3>\n\n\n\n<p>\u6dfb\u52a0\u5b8c\u4e0a\u8ff0\u51fd\u6570\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728\u540e\u53f0\u53d1\u73b0\u4e00\u4e2a\u201c\u8bf4\u8bf4\u201d\u7684\u83dc\u5355\uff0c\u901a\u8fc7\u83dc\u5355\u5373\u53ef\u7f16\u8f91\u8bf4\u8bf4\uff0c\u4f46\u662f\u6211\u4eec\u53d1\u73b0\u7f16\u8f91\u5b8c\u6210\u540e\u7684\u8bf4\u8bf4\u5e76\u4e0d\u80fd\u5728\u524d\u7aef\u663e\u793a\u51fa\u6765\uff0c\u8fd9\u662f\u6211\u4eec\u4eec\u9700\u8981\u65b0\u5efa\u4e00\u4e2a\u8bf4\u8bf4\u7684\u9875\u9762\u6a21\u677f\u63a7\u5236\u5176\u524d\u7aef\u663e\u793a\uff0c\u5c06\u4ee5\u4e0b\u4ee3\u7801\u590d\u5236\u5e76\u53e6\u5b58\u4e3a\u00a0page_shuoshuo.php \uff0c\u5e76\u4e0a\u4f20\u81f3\u4e3b\u9898\u6839\u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php \n\/* Template Name: \u8bf4\u8bf4\/\u5fc3\u60c5 *\/\nget_header(); \n?>\n&lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"&lt;?php echo get_template_directory_uri(); ?>\/css\/vertical_timeline.css\" \/>\n&lt;section class=\"container\">\n&lt;div class=\"content-wrap\">\n&lt;div class=\"content\">\n    &lt;div style=\"background: #FFF; padding: 30px; border-radius: 5px;\">\n        &lt;ul class=\"cbp_tmtimeline\">\n        &lt;?php \n        query_posts(\"post_type=shuoshuo &amp; post_status=publish &amp; posts_per_page=-1\");\n        if ( have_posts() ) { \n        while ( have_posts() ) { \n        the_post(); ?>\n            &lt;li>\n                &lt;time class=\"cbp_tmtime\">&lt;i class=\"fa fa-clock-o\">&lt;\/i> &lt;?php the_time('Y\u5e74n\u6708j\u65e5G:i'); ?>&lt;\/time>\n                &lt;div class=\"cbp_tmicon\">\n                &lt;img src=\"http:\/\/blog.quietguoguo.com\/qggblog\/wp-content\/uploads\/2018\/01\/zibuyulogo.png\" class=\"avatar avatar-48\" width=\"48\" height=\"48\">\n                &lt;\/div>\n                &lt;div class=\"cbp_tmlabel\" >\n                    &lt;span style=\"font-size:14px;\">&lt;?php the_content(); ?>&lt;\/span>\n                    &lt;h2>&lt;?php the_title(); ?>&lt;span>&lt;?php echo get_bloginfo('name'); ?> | &lt;?php echo get_bloginfo('description' ); ?>&lt;\/span>&lt;\/h2>\n                &lt;\/div>\n            &lt;\/li>\n        &lt;?php }\n        } ?>\n        &lt;\/ul>\n    &lt;\/div>\n&lt;\/div> \n&lt;\/div>\n&lt;?php get_sidebar(); ?>\n&lt;\/section>\n&lt;?php get_footer();?><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">CSS\u6837\u5f0f\u7f8e\u5316<\/h3>\n\n\n\n<p>\u5c06\u4ee5\u4e0b\u4ee3\u7801\u590d\u5236\u5e76\u4fdd\u5b58\u4e3a\u00a0vertical_timeline.css \u6587\u4ef6\uff0c\u76f4\u63a5\u4e22\u5230\u4e3b\u9898 css \u6587\u4ef6\u5939\u4e0b\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/** \u5782\u76f4\u65f6\u95f4\u7ebfCSS\u6837\u5f0f *\/\n \n.cbp_tmtimeline {\n    margin: 30px 0 0 0;\n    padding: 0;\n    list-style: none;\n    position: relative;\n} \n\/* The line *\/\n.cbp_tmtimeline:before {\n    content: '';\n    position: absolute;\n    top: 0;\n    bottom: 0;\n    width: 10px;\n    background: #afdcf8;\n    left: 20%;\n    margin-left: -6px;\n}\n\/* The date\/time *\/\n.cbp_tmtimeline > li .cbp_tmtime {\n    display: block;\n    width: 30%;\n    padding-right: 100px;\n    position: absolute;\n    color: #AAA;\n}\n.cbp_tmtimeline > li .cbp_tmtime span {\n    display: block;\n    text-align: right;\n}\n.cbp_tmtimeline > li .cbp_tmtime span:first-child {\n    font-size: 0.9em;\n    color: #bdd0db;\n}\n.cbp_tmtimeline > li .cbp_tmtime span:last-child {\n    font-size: 2.9em;\n    color: #24a0f0;\n}\n.cbp_tmtimeline > li:nth-child(odd) .cbp_tmtime span:last-child {\n    color: #7878f0;\n}\n\/* Right content *\/\n.cbp_tmtimeline > li .cbp_tmlabel {\n    margin: 0 0 15px 25%;\n    background: #24a0f0;\n    color: #fff;\n    padding: 0.8em;\n    font-size: 1.2em;\n    font-weight: 300;\n    line-height: 1.4;\n    position: relative;\n    border-radius: 5px;\n}\n.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel {\n    background: #7878f0;\n}\n.cbp_tmtimeline > li .cbp_tmlabel h2 { \n    border-bottom: 0px;\n    border-top:1px dashed #FFF; \n    font-size:16px; \n    height: 24px; \n    padding: 5px 3px 12px; \n    margin:0px;\n}\n.cbp_tmtimeline > li .cbp_tmlabel h2 > span { \n    font-size: 12px; \n    float: right; \n    text-align: center; \n    line-height: 24px; \n    overflow: hidden; \n    text-overflow: ellipsis; \n    white-space: nowrap;\n}\n\/* The triangle *\/\n.cbp_tmtimeline > li .cbp_tmlabel:after {\n    right: 100%;\n    border: solid transparent;\n    content: \" \";\n    height: 0;\n    width: 0;\n    position: absolute;\n    pointer-events: none;\n    border-right-color: #24a0f0;\n    border-width: 10px;\n    top: 10px;\n}\n.cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after {\n    border-right-color: #7878f0;\n}\n\/* The icons *\/\n.cbp_tmtimeline > li .cbp_tmicon {\n    width: 48px;\n    height: 48px;\n    font-family: 'ecoico';\n    speak: none;\n    font-style: normal;\n    font-weight: normal;\n    font-variant: normal;\n    text-transform: none;\n    font-size: 48px;\n    line-height: 48px;\n    -webkit-font-smoothing: antialiased;\n    position: relative;\n    color: #fff;\n    background: #46a4da;\n    border-radius: 50%;\n    box-shadow: 0 0 0 8px #afdcf8;\n    text-align: center;\n    left: 20%;\n    top: 0;\n    margin: 0 0 0 -25px;\n}\n.cbp_tmtimeline > li .cbp_tmicon >img {\n    border-radius: 50%; \n    position: absolute; \n    top: 0px; \n    left: 0px;\n}\n\/* Example Media Queries *\/\n@media screen and (max-width: 65.375em) {\n    .cbp_tmtimeline > li .cbp_tmtime span:last-child {\n        font-size: 1.5em;\n    }\n}\n@media screen and (max-width: 47.2em) {\n    .cbp_tmtimeline:before {\n        display: none;\n    }\n    .cbp_tmtimeline > li .cbp_tmtime {\n        width: 100%;\n        position: relative;\n        padding: 0 0 20px 0;\n    }\n    .cbp_tmtimeline > li .cbp_tmtime span {\n        text-align: left;\n    }\n    .cbp_tmtimeline > li .cbp_tmlabel {\n        margin: 0 0 30px 0;\n        padding: 1em;\n        font-weight: 400;\n        font-size: 95%;\n    }\n    .cbp_tmtimeline > li .cbp_tmlabel:after {\n        right: auto;\n        left: 20px;\n        border-right-color: transparent;\n        border-bottom-color: #24a0f0;\n        top: -20px;\n    }\n    .cbp_tmtimeline > li:nth-child(odd) .cbp_tmlabel:after {\n        border-right-color: transparent;\n        border-bottom-color: #7878f0;\n    }\n    .cbp_tmtimeline > li .cbp_tmicon {\n        position: relative;\n        float: right;\n        left: auto;\n        margin: -55px 5px 0 0px;\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u6837\u5f0f\u4ee3\u7801\u6765\u6e90\u4e8e jQuery \u63d2\u4ef6\u5e93\u7684\u5782\u76f4\u65f6\u95f4\u8f74\uff0c\u4e0d\u8fc7\u6211\u7a0d\u5fae\u505a\u4e86\u4e9b\u4fee\u6539\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u65b0\u5efa\u8bf4\u8bf4\u9875\u9762<\/h3>\n\n\n\n<p>\u4ee3\u7801\u90e8\u7f72\u5b8c\u6210\u540e\u524d\u5f80\u540e\u53f0\u65b0\u5efa\u4e00\u4e2a\u9875\u9762\uff0c\u9875\u9762\u6a21\u677f\u9009\u62e9\u201c\u8bf4\u8bf4\/\u5fc3\u60c5\u201d\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u4f60\u5c31\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u9875\u9762\u94fe\u63a5\u6765\u67e5\u770b\u53d1\u5e03\u7684\u8bf4\u8bf4\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f88\u591a\u7f51\u7ad9\u90fd\u6709\u4e00\u4e2a\u8bf4\u8bf4\/\u5fc3\u60c5\u7684\u9875\u9762\uff0c\u7528\u6765\u8bb0\u5f55\u81ea\u5df1\u6bcf\u65e5\u7684\u6240\u601d\u6240\u60f3\uff0c\u5f88\u662f\u4e0d\u9519\u3002\u81ea\u5df1\u4e4b\u524d\u90fd\u662f\u5c06\u81ea\u5df1\u7684\u5fc3\u60c5\u8bb0\u5f55\u5728\u6dfb\u52a0\u6298\u817e\u4e2a\u8bf4\u8bf4\/\u5fc3\u60c5\u7684\u9875\u9762\uff0c\u4ece\u7f51\u4e0a\u641c\u7d22\u4e86\u76f8\u5173\u6587\u7ae0\uff1b \u6ce8\u518c\u5e16\u5b50\u7c7b\u578b \u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528 WordPress \u7684\u00a0register_post_&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[103],"topic":[],"_links":{"self":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/171"}],"collection":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=171"}],"version-history":[{"count":1,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":172,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions\/172"}],"wp:attachment":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=171"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}