Skip to content

Commit

Permalink
init: kagami
Browse files Browse the repository at this point in the history
  • Loading branch information
yinian1992 committed Oct 24, 2020
0 parents commit c48c14f
Show file tree
Hide file tree
Showing 33 changed files with 1,813 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/assets/images/author/*
/assets/images/category/*
!.gitkeep
35 changes: 35 additions & 0 deletions 404.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
get_header();
?>

<main id="site-content" role="main">
<div class="hero">
<div class="hero-box">
<div class="container">
<header class="post-cover" style="background-image: url(<?php echo KAGAMI_FALLBACK_PAGE_NOT_FOUND_COVER_URL ?>)">
<div class="content">
<div class="post-title-group">
<a class="post-title-link" href="#"><h2 class="post-title"><?php _e( '404: Page not found', 'kagami' ) ?></h2></a>
<div class="post-meta">
What a pity !
</div>
</div>
</div>
</header>
<div class="hero-box-summary">
<p>Try to search for find life, the universe and everything ?</p>
<a class="hero-btn btn" href="/"><?php _e( 'Back to Home', 'kagami' ) ?></a>
</div>
</div>
</div>
<div class="hero-background-wrapper">
<div class="hero-background" style="background-image: url(<?php echo KAGAMI_FALLBACK_PAGE_NOT_FOUND_COVER_URL ?>)"></div>;
</div>
</div>
<div class="fill">
</div>
</main>

<?php
get_footer();
?>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
63 changes: 63 additions & 0 deletions archive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
get_header();

$title = get_the_archive_title();
$posts_number = 0;
$description = get_the_archive_description();
$cover_url = KAGAMI_FALLBACK_PAGE_NOT_FOUND_COVER_URL;
$has_button = false;
$button_text = '';
$button_link = '/';

if ( is_author() ) {
$posts_number = get_the_author_posts();
$cover_url = kagami_get_cover_url( 'author', get_the_author_meta( 'login' ), KAGAMI_FALLBACK_AUTHOR_COVER_URL );
$description = '<p>' . $description . '</p>';
$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
);

?>

<main id="site-content" role="main">
<?php get_template_part( 'template-parts/hero', 'archive', $hero_args ) ?>
<div class="fill">
<?php get_template_part( 'template-parts/post-list' ); ?>
<?php get_template_part( 'template-parts/pagination' ); ?>
</div><!-- kagami:fill -->
</main>

<?php
get_footer();
?>
Loading

0 comments on commit c48c14f

Please sign in to comment.