diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2bb44b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/assets/images/author/* +/assets/images/category/* +!.gitkeep \ No newline at end of file diff --git a/404.php b/404.php new file mode 100644 index 0000000..9eaf6d0 --- /dev/null +++ b/404.php @@ -0,0 +1,35 @@ + + +
+
+
+
+
+
+
+

+ +
+
+
+
+

Try to search for find life, the universe and everything ?

+ +
+
+
+
+
; +
+
+
+
+
+ + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..538dfaf --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 yinian@jinkan.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/archive.php b/archive.php new file mode 100644 index 0000000..587757b --- /dev/null +++ b/archive.php @@ -0,0 +1,63 @@ +' . $description . '

'; + $email = get_the_author_meta( 'email' ) ; + if ( $email ) { + $has_button = true; + $button_text = __('Contact the author', 'kagami'); + $base64_mailto = base64_encode( sprintf( 'mailto:%1$s', get_the_author_meta( 'email' ) ) ); + $button_link = sprintf( 'javascript:(()=>{window.location.href=atob(\'%1$s\')})()', $base64_mailto ); + } +} elseif ( is_category() ) { + $category = get_queried_object(); + $posts_number = $category->count; + $cover_url = kagami_get_cover_url( 'category', $category->slug, KAGAMI_FALLBACK_CATEGORY_COVER_URL ); +} elseif ( is_tag() ) { + $tag = get_queried_object(); + $posts_number = $tag->count; + $cover_url = kagami_get_cover_url( 'tag', $category->slug, KAGAMI_FALLBACK_TAG_COVER_URL ); +} + +$hero_args = array( + 'title' => $title, + 'subtitle' => sprintf( + _nx( + '%1$s post', + '%1$s posts', + $posts_number, + 'posts title', + 'kagami' + ), + number_format_i18n( $posts_number ) ), + 'description' => $description, + 'cover_url' => $cover_url, + 'has_button' => $has_button, + 'button_text' => $button_text, + 'button_link' => $button_link +); + +?> + +
+ +
+ + +
+
+ + \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..7dc8502 --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,651 @@ +/* General */ + +body { + font-size: 14px; + font-family: var(--sans-serif-font-family); + margin:0; + padding:0; + color: var(--text-color); +} + +a, a:visited { + color: var(--link-color); + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +.btn, +a.btn { + display: inline-block; + border: 0; + border-radius:48px; + background: var(--primary-color); + color: var(--white-color); + padding: 8px 14px; + font-size: 16px; + font-family: var(--sans-serif-font-family); + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0,0,0,.12); + box-shadow: 0 2px 0 rgba(0,0,0,.045); + transition: all .3s cubic-bezier(.645,.045,.355,1); + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; +} + +.btn:hover, +a.btn:hover { + color: var(--white-color); + background-color: var(--primary-hover-color); + cursor: pointer; + text-decoration: none; +} + +.divider { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + margin: 16px 0; + color: #ddd; + font-weight: 500; + font-size: 16px; + white-space: nowrap; + text-align: center; + border-top: 0; + border-top-color: currentcolor; + border-top-color: rgba(0,0,0,.06); + clear: both; + width: 100%; + min-width: 100%; +} + +.divider:before, +.divider:after { + position: relative; + top: 50%; + width: 50%; + border-top: 1px solid transparent; + border-top-color: transparent; + border-top-color: inherit; + border-bottom: 0; + -webkit-transform: translateY(50%); + transform: translateY(50%); + content: ""; +} + +.divider .inner-text { + display: inline-block; + padding: 0 1em; + text-shadow: 0 -1px 0 rgba(0,0,0,.045); +} + +.container { + max-width: 760px; + margin: 0 auto 0 auto; +} + +.content { + padding: 40px; + box-sizing: border-box; +} + +/* TopBar */ + +.topbar { + position: absolute; + top: 40px; + left: 0; + z-index: 3; + width: 100%; +} + +.topbar .logo-link, +.topbar .logo-link:visited +.topbar .logo-link:hover { + text-decoration: none; +} + +.topbar .logo { + height: 36px; + width: 210px; + color: transparent; + user-select: none; + background-image: var(--logo-image); + background-size: 100%; + background-repeat: no-repeat; +} + +.topbar>.container { + padding: 0 8px 0 8px; +} + +.topnav { + margin-top: 24px; +} + +.topnav>ul { + margin: 0; + padding: 0; + list-style: none; + display: flex; +} + +.topnav>ul>li { + margin-right: 20px; +} + +.topnav>ul>li>a { + color: #f5f5f5; + text-decoration: none; + padding-bottom: 8px; + letter-spacing: 2px; + text-transform: uppercase; +} + +.topnav>ul>li.current-menu-item>a { + border-bottom: 2px solid #f5f5f580; +} + +.fill { + position: relative; + padding-top: 120px; + background-image: var(--fill-background-image); + background-color: #fff; +} + +main { + position: relative; + z-index: 2; +} + +/* Hero */ + +.hero { + height: 640px; + position: relative; + top: 0; +} + +.hero-background-wrapper { + overflow: hidden; + height: 100%; +} + +.hero-background { + filter: blur(3px) brightness(80%); + transform: scale(1.05); + background-position: 50% 50%; + background-size: cover; + width: 100%; + height: 100%; + position: relative; + z-index: -1; +} + +.hero-box { + position: absolute; + top: 200px; + left: 0; + width: 100%; + z-index: 3; +} + +.hero-box>.container { + font-weight: 300; + box-shadow: 0 0 64px 0 rgba(0,0,0,.3) +} + +.hero-box>.container>header { + box-sizing: border-box; + height: 320px; + background-position: 50% 50%; + background-size: cover; + position: relative; + transition: all .3s cubic-bezier(.645,.045,.355,1); +} + +.hero-box>.container>header:hover { + filter: brightness(110%); +} + +.hero-box>.container>header .hero-box-title { + bottom: 20px; + position: absolute; + color: var(--white-color); + font-size: 26px; + font-weight: 500; + font-family: var(--serif-font-family); + text-shadow: 0 -1px 0 rgba(0,0,0,.12); +} + +.post-cover .post-category { + color: var(--white-color)cc; + background: rgba(0,0,0,.3); + transition: all .3s cubic-bezier(.645,.045,.355,1); + padding: 6px 12px; + border-radius: 32px; + font-size: 12px; + float: right; + position: relative; + text-decoration: none; + text-transform: uppercase; +} + +.post-cover .post-category:hover { + color: var(--white-color)ee; + background: rgba(0,0,0,.4); +} + +.hero-box .post-cover .content { + height: 320px; + width: 100%; + position: relative; +} + +.hero-box .hero-box-summary, +.hero-box .hero-box-content { + box-sizing: border-box; + height: 180px; + background: var(--white-color); + padding: 24px 40px 40px 40px; + font-family: var(--serif-font-family); + text-shadow: 0 -1px 0 rgba(0,0,0,.12); +} + +.hero-box .hero-box-content { + height: auto; +} + +.hero-box .hero-box-summary>p { + margin:0 0 48px 0; +} + +.post-cover { + background-color: #333; + background-position: 50% 50%; + background-size: cover; + box-shadow: 0 0 64px 0 rgba(0,0,0,.3); + margin-bottom: 30px; + box-sizing: border-box; + position: relative; + height: 240px; + transition: all .3s cubic-bezier(.645,.045,.355,1); + color: var(--white-color); +} + +.post-cover a, +.post-cover a:visited { + color: var(--white-color)cc; + transition: all .3s cubic-bezier(.645,.045,.355,1); +} + +.post-cover a:hover { + color: var(--white-color)ee; +} + +.post-cover .post-overlay { + width: 100%; + height: 100%; + background: linear-gradient(to bottom, transparent 40%, #000); + opacity: .67; + position: absolute; + top: 0; + transition: all .3s cubic-bezier(.645,.045,.355,1); +} + +.post-cover:hover .post-overlay { + opacity: .3; +} + +.post-cover .content { + height: 240px; + width: 100%; + position: relative; +} + +.post-cover .post-meta { + margin-top: 8px; + user-select: none; + font-size: 12px; + color: rgba(255,255,255,.8); +} + +.post-cover .post-meta span { + margin-right: 8px; +} + +.post-cover .post-meta span:last-child { + margin:0; +} + +.post-cover .post-title-group { + position: absolute; + bottom: 40px; + width: 70%; +} + +.post-cover .post-title-link, +.post-cover .post-title-link:visited { + color: var(--white-color); + text-decoration: none; +} + +.post-cover .post-title-link:hover { + color: var(--white-color); +} + +.post-cover .post-author { + display: flex; + bottom: 32px; + right: 40px; + position: absolute; + padding: 8px 14px; + box-sizing: border-box; + border-radius: 42px; + transition: all .3s cubic-bezier(.645,.045,.355,1); +} + +.post-cover .post-author:hover { + background-color: rgba(0,0,0,.3); +} + +.post-cover .post-author-name { + line-height: 36px; + margin-left: 8px; +} + +header.post-cover { + margin-bottom: 0; +} + +.post-cover .post-title { + margin: 0; + font-size: 24px; + font-weight: 500; + font-family: var(--serif-font-family); + text-shadow: 0 -1px 0 rgba(0,0,0,.12); +} + +.post-cover .post-author-avatar { + width: 36px; + height: 36px; + border-radius: 36px; +} + +/* Pagination */ + +.pagination { + padding-bottom: 40px; + text-align: center; +} + +.pagination .page-numbers { + display: inline-block; + border-radius:48px; + background: var(--primary-color); + color: var(--white-color); + padding: 8px 16px; + font-size: 16px; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0,0,0,.12); + box-shadow: 0 2px 0 rgba(0,0,0,.045); + transition: all .3s cubic-bezier(.645,.045,.355,1); + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + margin-right: 4px; +} + +.pagation .page-numbers.next, +.pagation .page-numbers.previous { + padding: 8px 14px; +} + +.pagation .page-numbers:last-child { + margin: 0; +} + +.pagination .page-numbers.current, +.pagination .page-numbers:hover { + color: var(--white-color); + background-color: var(--primary-hover-color); + cursor: pointer; +} + +/* Footer */ + +.footer-holder { + position: relative; + height: 200px; + z-index: -1; +} + +footer.bottom { + position: fixed; + bottom: 0; + width: 100%; + height: 200px; + background-color: var(--footer-gradient-start-color); + background: linear-gradient(135deg, var(--footer-gradient-start-color), var(--footer-gradient-end-color)); + color: var(--white-color); + z-index: 1; +} + +footer.bottom p { + font-family: var(--serif-font-family); + margin: 0; + position: relative; + top: 70px; + font-size: 12px; + font-weight: 200; + line-height: 1.5em; + text-align: center; + text-shadow: 0 -1px 0 rgba(0,0,0,.1); +} + +footer.bottom a, footer.bottom a:visited { + color: var(--white-color); +} + +footer.bottom .footer-logo { + position: relative; + top: 40px; + margin: 0 auto; + height: 28px; + width: 168px; + background-size: 100%; + background-image: var(--logo-image); + background-repeat: no-repeat; + filter: drop-shadow(0 -1px 0 rgba(0,0,0,.1)); +} + +/* Singular */ + +.singular .hero-box { + position: relative; + top:0; + left:0; + margin-top:-560px; +} + +.singular .hero-box-content { + font-size: 16px; + font-weight: normal; + word-break: break-word; +} + +.singular .hero-box-content p { + line-height: 28px; +} + +.singular .hero-box-content code { + display: inline-block; + border-radius:4px; + background: #e2e4f2; + font-size: 13px; + line-height: 18px; + padding: 1px 4px; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0,0,0,.12); +} + +.singular .hero-box-content pre { + background-color: #efeff2; + overflow: auto; + padding: 8px; +} + +.singular .hero-box-content pre code { + color: #333; + background: transparent; + text-shadow: 0 -1px 0 rgba(0,0,0,.12); + box-shadow: none; +} + +.singular .hero-box-content table { + border-spacing: 0; + border-collapse: collapse; +} + +.singular .hero-box-content td, +.singular .hero-box-content th { + border: 1px solid #e2e4f2; + padding: 8px; +} + +.singular .post-author { + text-align: center; +} + +.singular .post-author .avatar { + border-radius: 48px; +} + +.singular .post-author .post-author-name { + margin: 8px 0; +} + +.singular .post-author .post-author-description { + font-size: 12px; +} + + +.singular .post-tag { + font-size: 12px; + padding: 4px 8px; + margin-right: 4px; +} + +/* Comments */ + +.comments-wrapper { + position: relative; + margin-top: 64px; + box-shadow: 0 0 64px 0 rgba(0,0,0,.3); + background-color: var(--white-color); +} + +.comments { + font-family: var(--serif-font-family); +} + +.comments a, +.comments a:visited, +.comment-respond a, +.comment-respond a:visited{ + color: #333; +} + + +.comment-meta { + display: flex; +} + +.comment-meta-part { + display: flex; + flex-direction: column; + margin-left: 12px; +} + +.comment-reply-meta { + flex-grow: 1; + text-align: right; + font-size: 12px; +} + +.comment-meta .avatar { + width: 48px; + height: 48px; + border-radius: 24px; +} + +.comment-author-name { + font-size: 14px; +} + +.comment-on { + font-size: 12px; +} + +.comment-author-avatar { + position: relative; +} + +.comment-by-staff { + width: 12px; + height: 12px; + border-radius: 6px; + border: 2px solid rgba(255,255,255,.3); + background: #f005; + position: absolute; + left: 38px; + top: 0; + box-sizing: border-box; +} + +.comments-closed { + text-align: center; +} + +.comment>.comment-content { + margin-bottom: 24px; + border-bottom: 1px solid rgba(0,0,0,.06); + padding-left: 60px; +} + +.comments .parent-comment { + background-color: #efeff2; + padding: 8px; + font-size: 12px; +} + +.comment-respond p { + margin: 8px 0; +} + +.comment-respond input[type=text], +.comment-respond input[type=email], +.comment-respond input[type=url], +.comment-respond textarea { + border: 1px solid #d9d9d9; + width: 100%; + padding: 8px 14px; + box-sizing: border-box; +} +.comment-respond input[type=text]:hover, +.comment-respond input[type=email]:hover, +.comment-respond input[type=url]:hover, +.comment-respond textarea:hover, +.comment-respond input[type=text]:focus, +.comment-respond input[type=email]:focus, +.comment-respond input[type=url]:focus, +.comment-respond textarea:focus { + border-color: var(--primary-color); +} + +.comment-respond textarea { + resize: vertical; +} \ No newline at end of file diff --git a/assets/css/variables.css.php b/assets/css/variables.css.php new file mode 100644 index 0000000..72f6ecc --- /dev/null +++ b/assets/css/variables.css.php @@ -0,0 +1,16 @@ + + + +:root { + --primary-color: ; + --primary-hover-color: ; + --text-color: ; + --link-color: ; + --white-color: ; + --sans-serif-font-family: ; + --serif-font-family: ; + --logo-image: url(); + --footer-gradient-start-color: ; + --footer-gradient-end-color: ; + --fill-background-image: url(); +} \ No newline at end of file diff --git a/assets/images/author/.gitkeep b/assets/images/author/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/assets/images/category/.gitkeep b/assets/images/category/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/assets/images/fallback_archive_cover.jpg b/assets/images/fallback_archive_cover.jpg new file mode 100644 index 0000000..775b7f5 Binary files /dev/null and b/assets/images/fallback_archive_cover.jpg differ diff --git a/assets/images/fallback_author_cover.jpg b/assets/images/fallback_author_cover.jpg new file mode 100644 index 0000000..b183955 Binary files /dev/null and b/assets/images/fallback_author_cover.jpg differ diff --git a/assets/images/fallback_cover.jpg b/assets/images/fallback_cover.jpg new file mode 100644 index 0000000..fdc5a4f Binary files /dev/null and b/assets/images/fallback_cover.jpg differ diff --git a/assets/images/lab_logo_hori_white.png b/assets/images/lab_logo_hori_white.png new file mode 100644 index 0000000..d966329 Binary files /dev/null and b/assets/images/lab_logo_hori_white.png differ diff --git a/assets/images/light_toast.png b/assets/images/light_toast.png new file mode 100644 index 0000000..b6b954d Binary files /dev/null and b/assets/images/light_toast.png differ diff --git a/comments.php b/comments.php new file mode 100644 index 0000000..502261f --- /dev/null +++ b/comments.php @@ -0,0 +1,60 @@ + +
+
+ + + +
+ new Kagami_Walker_Comment(), + 'avatar_size' => 120, + 'style' => 'div', + ) + ); + ?> +
+ +
+ '

', + 'title_reply_after' => '

', + 'class_submit' => 'btn' + ) + ); +} elseif ( is_singular() ) { ?> +

+ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..87ede85 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3.1' + +services: + + wordpress: + image: wordpress + restart: always + ports: + - 8080:80 + environment: + WORDPRESS_DB_HOST: db + WORDPRESS_DB_USER: wordpress + WORDPRESS_DB_PASSWORD: wordpress + WORDPRESS_DB_NAME: wordpress + volumes: + - wordpress:/var/www/html + - .:/var/www/html/wp-content/themes/kagami + + db: + image: mariadb + restart: always + environment: + MYSQL_DATABASE: wordpress + MYSQL_USER: wordpress + MYSQL_PASSWORD: wordpress + MYSQL_RANDOM_ROOT_PASSWORD: wordpress + volumes: + - db:/var/lib/mysql + +volumes: + db: + wordpress: diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..d6060d1 --- /dev/null +++ b/footer.php @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..861c638 --- /dev/null +++ b/functions.php @@ -0,0 +1,177 @@ + __( 'Top Menu', 'kagami' ), + 'social' => __( 'Social Links Menu', 'kagami' ), + ) + ); + add_theme_support( + 'custom-logo', + array( + 'height' => 50, + 'width' => 300, + 'flex-width' => true, + ) + ); + // add_theme_support( 'custom-background' ); + add_theme_support( 'post-thumbnails' ); + add_theme_support( 'title-tag' ); + add_theme_support( + 'html5', + array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + 'script', + 'style', + ) + ); + load_theme_textdomain( 'kagami' ); +} + +// +require get_template_directory() . '/inc/template-tags.php'; +require get_template_directory() . '/inc/class-kagami-walker-comment.php'; + + +function kagami_customize_register( $wp_customize ) { + $wp_customize->add_section( 'kagami', array( + 'title' => __( 'Kagami Settings', 'kagami' ), + 'description' => __( 'Kagami Settings', 'kagami' ), + 'panel' => '', // Not typically needed. + 'priority' => 160, + 'capability' => 'edit_theme_options', + 'theme_supports' => '', // Rarely needed. + )); + $wp_customize->add_section( 'footer', array( + 'title' => __( 'Footer', 'kagami' ), + 'description' => __( 'Footer', 'kagami' ), + 'panel' => '', // Not typically needed. + 'priority' => 161, + 'capability' => 'edit_theme_options', + 'theme_supports' => '', // Rarely needed. + )); + $wp_customize->add_setting( 'primary_color', array( + 'default' => '#6b7dd6', + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_hex_color', + )); + $wp_customize->add_setting( 'text_color', array( + 'default' => '#333', + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_hex_color', + )); + $wp_customize->add_setting( 'footer_gradient_start_color', array( + 'default' => '#6b7dd6', + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_hex_color', + )); + $wp_customize->add_setting( 'footer_gradient_end_color', array( + 'default' => '#001689', + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_hex_color', + )); + $wp_customize->add_setting( 'footer_slogan', array( + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_text_field', + )); + $wp_customize->add_setting( 'icp_number', array( + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_text_field', + )); + $wp_customize->add_setting( 'footer_extra', array( + 'type' => 'theme_mod', + 'sanitize_callback' => 'sanitize_text_field', + )); + $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( + 'label' => __( 'Primary Color', 'kagami' ), + 'section' => 'colors', + ))); + $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'text_color', array( + 'label' => __( 'Text Color', 'kagami' ), + 'section' => 'colors', + ))); + $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'footer_gradient_start_color', array( + 'label' => __( 'Footer Color Start', 'kagami' ), + 'section' => 'footer', + ))); + $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'footer_gradient_end_color', array( + 'label' => __( 'Footer Color End', 'kagami' ), + 'section' => 'footer', + ))); + $wp_customize->add_control( 'footer_slogan', array( + 'label' => __( 'Footer Slogan', 'kagami' ), + 'type' => 'text', + 'section' => 'footer', + )); + $wp_customize->add_control( 'icp_number', array( + 'label' => __( 'ICP Number', 'kagami' ), + 'type' => 'text', + 'section' => 'footer', + )); + $wp_customize->add_control( 'footer_extra', array( + 'label' => __( 'Extra Content', 'kagami' ), + 'type' => 'text', + 'section' => 'footer', + )); +} +add_action('customize_register', 'kagami_customize_register'); + + + +add_action( 'wp_enqueue_scripts', 'kagami_scripts' ); +function kagami_scripts() { + $variables_version = md5_file( get_theme_file_path( '/assets/css/variables.css.php' ) ); + wp_enqueue_style( 'kagami-variables', admin_url( 'admin-ajax.php' ).'?action=dynamic_css', array(), $variables_version ); + wp_enqueue_style( 'kagami-style', get_theme_file_uri( '/assets/css/style.css' )); + wp_enqueue_style( 'font-awesome', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.1/css/all.min.css' ); +} + + +add_filter( 'excerpt_length', 'kagami_excerpt_length' ); +function kagami_excerpt_length( $length ) { + return 70; +} + + +add_filter( 'excerpt_more', 'kagami_excerpt_more' ); +function kagami_excerpt_more( $more ) { + return "..."; +} + +add_filter( 'comment_excerpt_length', 'kagami_comment_excerpt_length' ); +function kagami_comment_excerpt_length( $length ) { + return 70; +} + + +add_action( 'wp_ajax_dynamic_css', 'kagami_dynamic_css' ); +add_action( 'wp_ajax_nopriv_dynamic_css', 'kagami_dynamic_css' ); +function kagami_dynamic_css() { + require get_theme_file_path( '/assets/css/variables.css.php' ); + exit; +} + +add_filter( 'get_the_archive_title', 'kagami_archive_title' ); +function kagami_archive_title( $title ) { + if ( is_category() ) { + $title = single_cat_title( '', false ); + } elseif ( is_tag() ) { + $title = single_tag_title( '', false ); + } elseif ( is_author() ) { + $title = get_the_author(); + } elseif ( is_post_type_archive() ) { + $title = post_type_archive_title( '', false ); + } elseif ( is_tax() ) { + $title = single_term_title( '', false ); + } + return $title; +} +?> \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..064321c --- /dev/null +++ b/header.php @@ -0,0 +1,35 @@ + + +> + + + + + + + + + +
+
+ ', get_bloginfo('wpurl'), get_bloginfo('name')) ?> +

+ + +
+
\ No newline at end of file diff --git a/inc/class-kagami-walker-comment.php b/inc/class-kagami-walker-comment.php new file mode 100644 index 0000000..d83bb72 --- /dev/null +++ b/inc/class-kagami-walker-comment.php @@ -0,0 +1,73 @@ +comment_parent ); + $comment_reply_link = get_comment_reply_link( + array_merge( + $args, + array( + 'add_below' => 'comment', + 'depth' => $depth, + 'max_depth' => $args['max_depth'], + 'before' => '', + 'after' => '', + ) + ) + ); + $by_staff = kagami_is_comment_by_staff( $comment ); + printf('
',$comment->comment_ID); +?> +
+
+
'; + } + ?> +
+
+
+
+ + + + +
+
+
+ +
+ +
+ comment_ID != $comment->comment_ID ) { + $reply_to = $parent_comment->comment_author; + printf( __('

@%2$s %3$s

'), $parent_comment->comment_ID , $parent_comment->comment_author, esc_html(get_comment_excerpt($parent_comment))); + } + comment_text(); + if ( '0' === $comment->comment_approved ) { ?> +

+ +
+ \ No newline at end of file diff --git a/inc/constants.php b/inc/constants.php new file mode 100644 index 0000000..ca2d471 --- /dev/null +++ b/inc/constants.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/inc/template-tags.php b/inc/template-tags.php new file mode 100644 index 0000000..575929a --- /dev/null +++ b/inc/template-tags.php @@ -0,0 +1,58 @@ +user_id > 0 ) { + + $user = get_userdata( $comment->user_id ); + $post = get_post( $comment->comment_post_ID ); + + if ( ! empty( $user ) && ! empty( $post ) ) { + + return $comment->user_id === $post->post_author; + + } + } + return false; +} + +function kagami_is_comment_by_staff( $comment = null ) { + if ( is_object( $comment ) && $comment->user_id > 0 ) { + + $staff_roles = array( + 'administrator', + 'editor', + 'author' + ); + $user = get_userdata( $comment->user_id ); + + if ( ! empty( $user ) ) { + foreach ( $user->roles as $role ) { + if ( in_array( $role, $staff_roles ) ) { + return true; + } + } + } + } + return false; +} + +function kagami_get_cover_url( $type, $name, $fallback = KAGAMI_FALLBACK_COVER_URL ) { + $extensions = array('jpg', 'png'); + foreach ( $extensions as $extension ) { + $relative_path = sprintf( '/assets/images/%1$s/%2$s.%3$s', $type, $name, $extension ); + $cover_path = get_theme_file_path( $relative_path ); + if ( is_file( $cover_path ) ) { + return get_theme_file_uri( $relative_path ); + } + } + return $fallback; +} + +function kagami_get_theme_mod_image_url( $name, $fallback ) { + $image_id = get_theme_mod( $name ); + if ( ! $image_id ) { + return $fallback; + } + $image = wp_get_attachment_image_src( $image_id , 'full' ); + return $image[0]; +} +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..aa98b1b --- /dev/null +++ b/index.php @@ -0,0 +1,26 @@ + 1, + 'post__in' => get_option( 'sticky_posts' ), + 'ignore_sticky_posts' => 1 +); +$sticky_query = new WP_Query( $args ); +if ( $sticky_query->have_posts() ) { + $sticky_query->the_post(); +} +?> + +
+ + +
+ + +
+
+ + \ No newline at end of file diff --git a/kagami.pot b/kagami.pot new file mode 100644 index 0000000..efab1cc --- /dev/null +++ b/kagami.pot @@ -0,0 +1,164 @@ +# Copyright (C) 2020 yinian@jinkan.org +# This file is distributed under the GNU General Public License v2 or later. +msgid "" +msgstr "" +"Project-Id-Version: Kagami 1.0\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/theme/kagami\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2020-10-22T13:41:22+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.4.0\n" +"X-Domain: kagami\n" + +#. Theme Name of the theme +msgid "Kagami" +msgstr "" + +#. Theme URI of the theme +msgid "https://github.com/jinkanhq/kagami" +msgstr "" + +#. Description of the theme +msgid "Kagami Theme" +msgstr "" + +#. Author of the theme +msgid "yinian@jinkan.org" +msgstr "" + +#. Author URI of the theme +msgid "https://jinkan.org" +msgstr "" + +#: 404.php:11 +msgid "404: Page not found" +msgstr "" + +#: 404.php:19 +msgid "Back to Home" +msgstr "" + +#: archive.php:17 +msgid "Contact the author" +msgstr "" + +#: archive.php:33 +msgctxt "posts title" +msgid "%1$s post" +msgid_plural "%1$s posts" +msgstr[0] "" +msgstr[1] "" + +#: comments.php:21 +msgid "Leave a comment" +msgstr "" + +#. translators: %s: Post title. +#: comments.php:24 +msgctxt "comments title" +msgid "One reply" +msgstr "" + +#. translators: 1: Number of comments, 2: Post title. +#: comments.php:28 +#: template-parts/post-cover.php:12 +msgctxt "comments title" +msgid "%1$s reply" +msgid_plural "%1$s replies" +msgstr[0] "" +msgstr[1] "" + +#: comments.php:61 +msgid "Newer Comments" +msgstr "" + +#: comments.php:62 +msgid "Older Comments" +msgstr "" + +#: comments.php:75 +msgid "Comments" +msgstr "" + +#: comments.php:109 +msgid "Comments are closed." +msgstr "" + +#: functions.php:9 +msgid "Top Menu" +msgstr "" + +#: functions.php:10 +msgid "Social Links Menu" +msgstr "" + +#: functions.php:46 +#: functions.php:47 +msgid "Kagami Settings" +msgstr "" + +#: functions.php:54 +#: functions.php:55 +msgid "Footer" +msgstr "" + +#: functions.php:94 +msgid "Primary Color" +msgstr "" + +#: functions.php:98 +msgid "Text Color" +msgstr "" + +#: functions.php:102 +msgid "Footer Color Start" +msgstr "" + +#: functions.php:106 +msgid "Footer Color End" +msgstr "" + +#: functions.php:110 +msgid "Footer Slogan" +msgstr "" + +#: functions.php:115 +msgid "ICP Number" +msgstr "" + +#: functions.php:120 +msgid "Extra Content" +msgstr "" + +#. translators: 1: Comment date, 2: Comment time. +#: inc/class-kagami-walker-comment.php:78 +msgid "%1$s %2$s" +msgstr "" + +#: inc/class-kagami-walker-comment.php:109 +msgid "Your comment is awaiting moderation." +msgstr "" + +#: singular.php:32 +msgid "Tags" +msgstr "" + +#: singular.php:42 +msgid "About the author" +msgstr "" + +#: template-parts/hero.php:17 +msgid "Read more" +msgstr "" + +#: template-parts/post-cover.php:34 +msgid "Uncategorized" +msgstr "" + +#: template-parts/post-cover.php:41 +msgid "Published on" +msgstr "" diff --git a/languages/zh_CN.mo b/languages/zh_CN.mo new file mode 100644 index 0000000..0cf5e89 Binary files /dev/null and b/languages/zh_CN.mo differ diff --git a/languages/zh_CN.po b/languages/zh_CN.po new file mode 100644 index 0000000..a60d159 --- /dev/null +++ b/languages/zh_CN.po @@ -0,0 +1,161 @@ +# Copyright (C) 2020 yinian@jinkan.org +# This file is distributed under the GNU General Public License v2 or later. +msgid "" +msgstr "" +"Project-Id-Version: Kagami 1.0\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/theme/kagami\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2020-10-22T13:41:22+00:00\n" +"PO-Revision-Date: 2020-10-23 20:14+0800\n" +"X-Generator: Poedit 2.4\n" +"X-Domain: kagami\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: zh_CN\n" + +#. Theme Name of the theme +msgid "Kagami" +msgstr "Kagami" + +#. Theme URI of the theme +msgid "https://github.com/jinkanhq/kagami" +msgstr "https://github.com/jinkanhq/kagami" + +#. Description of the theme +msgid "Kagami Theme" +msgstr "Kagami 主题" + +#. Author of the theme +msgid "yinian@jinkan.org" +msgstr "yinian@jinkan.org" + +#. Author URI of the theme +msgid "https://jinkan.org" +msgstr "https://jinkan.org" + +#: 404.php:11 +msgid "404: Page not found" +msgstr "404:页面未找到" + +#: 404.php:19 +msgid "Back to Home" +msgstr "返回首页" + +#: archive.php:17 +msgid "Contact the author" +msgstr "联系作者" + +#: archive.php:33 +msgctxt "posts title" +msgid "%1$s post" +msgid_plural "%1$s posts" +msgstr[0] "%1$s 篇文章" + +#: comments.php:21 +msgid "Leave a comment" +msgstr "发表评论" + +#. translators: %s: Post title. +#: comments.php:24 +msgctxt "comments title" +msgid "One reply" +msgstr "1 条评论" + +#. translators: 1: Number of comments, 2: Post title. +#: comments.php:28 template-parts/post-cover.php:12 +msgctxt "comments title" +msgid "%1$s reply" +msgid_plural "%1$s replies" +msgstr[0] "%1$s 条评论" + +#: comments.php:61 +msgid "Newer Comments" +msgstr "更新的评论" + +#: comments.php:62 +msgid "Older Comments" +msgstr "更旧的评论" + +#: comments.php:75 +msgid "Comments" +msgstr "评论" + +#: comments.php:109 +msgid "Comments are closed." +msgstr "已关闭评论。" + +#: functions.php:9 +msgid "Top Menu" +msgstr "顶栏菜单" + +#: functions.php:10 +msgid "Social Links Menu" +msgstr "社交链接菜单" + +#: functions.php:46 functions.php:47 +msgid "Kagami Settings" +msgstr "Kagami 设置" + +#: functions.php:54 functions.php:55 +msgid "Footer" +msgstr "页脚" + +#: functions.php:94 +msgid "Primary Color" +msgstr "主颜色" + +#: functions.php:98 +msgid "Text Color" +msgstr "文字颜色" + +#: functions.php:102 +msgid "Footer Color Start" +msgstr "页脚渐变起始颜色" + +#: functions.php:106 +msgid "Footer Color End" +msgstr "页脚渐变结束颜色" + +#: functions.php:110 +msgid "Footer Slogan" +msgstr "页脚口号" + +#: functions.php:115 +msgid "ICP Number" +msgstr "ICP备案号" + +#: functions.php:120 +msgid "Extra Content" +msgstr "额外内容" + +#. translators: 1: Comment date, 2: Comment time. +#: inc/class-kagami-walker-comment.php:78 +msgid "%1$s %2$s" +msgstr "%1$s %2$s" + +#: inc/class-kagami-walker-comment.php:109 +msgid "Your comment is awaiting moderation." +msgstr "你的评论需要审核。" + +#: singular.php:32 +msgid "Tags" +msgstr "标签" + +#: singular.php:42 +msgid "About the author" +msgstr "关于作者" + +#: template-parts/hero.php:17 +msgid "Read more" +msgstr "更多内容" + +#: template-parts/post-cover.php:34 +msgid "Uncategorized" +msgstr "未分类" + +#: template-parts/post-cover.php:41 +msgid "Published on" +msgstr "发表于" diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..ad8dd35 Binary files /dev/null and b/screenshot.png differ diff --git a/singular.php b/singular.php new file mode 100644 index 0000000..76493b5 --- /dev/null +++ b/singular.php @@ -0,0 +1,64 @@ + +
+ +
+
+
+ true) ); ?> +
+ + +
+
+
+ +
+
+
+ + + +
+
+
+
+ +
+ + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..2e24238 --- /dev/null +++ b/style.css @@ -0,0 +1,15 @@ +/* +Theme Name: Kagami +Theme URI: https://github.com/jinkanhq/kagami +Author: yinian@jinkan.org +Author URI: https://jinkan.org +Description: Kagami Theme +Tags: blog, one-column, custom-background, custom-colors, custom-logo, custom-menu, editor-style, featured-images, sticky-post, theme-options, threaded-comments, translation-ready, +Version: 1.0 +Requires at least: 5.0 +Tested up to: 5.4 +Requires PHP: 7.0 +License: MIT License +License URI: https://opensource.org/licenses/MIT +Text Domain: kagami +*/ \ No newline at end of file diff --git a/template-parts/hero-archive.php b/template-parts/hero-archive.php new file mode 100644 index 0000000..bda0b86 --- /dev/null +++ b/template-parts/hero-archive.php @@ -0,0 +1,37 @@ + + +
+
+
+
+
+
+
+

+ +
+
+
+
+ + %3$s', $button_link, $button_attributions, $button_text ); + } + ?> +
+
+
+
+
; +
+
\ No newline at end of file diff --git a/template-parts/hero.php b/template-parts/hero.php new file mode 100644 index 0000000..46fe674 --- /dev/null +++ b/template-parts/hero.php @@ -0,0 +1,21 @@ + +
+ +
+
+ true) ); ?> +
+ + %s', get_permalink(), __('Read more', 'kagami') ); ?> +
+
+
+ +
+
', $full_thumbnail_url ); ?> +
+ + diff --git a/template-parts/pagination.php b/template-parts/pagination.php new file mode 100644 index 0000000..29e7469 --- /dev/null +++ b/template-parts/pagination.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/template-parts/post-cover.php b/template-parts/post-cover.php new file mode 100644 index 0000000..59a8aab --- /dev/null +++ b/template-parts/post-cover.php @@ -0,0 +1,54 @@ + + +', $html_tag, $large_thumbnail_url ) ?> +
+
+ %2$s', + get_category_link( $categories[0] ), + $categories[0]->name ); + } else { + printf( '', + get_category_link( 1 ), + __( 'Uncategorized', 'kagami' ) ); + } + ?> +
+

%2$s

', + get_permalink(), + get_the_title() ); + ?> + +
+ + + + + +
+', $html_tag ) ?> \ No newline at end of file diff --git a/template-parts/post-list.php b/template-parts/post-list.php new file mode 100644 index 0000000..23f602a --- /dev/null +++ b/template-parts/post-list.php @@ -0,0 +1,13 @@ +
+ +
\ No newline at end of file