Skip to content

Commit

Permalink
AMPにSVGアイコンを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Nov 28, 2016
1 parent 1d822aa commit 644108e
Show file tree
Hide file tree
Showing 15 changed files with 638 additions and 14 deletions.
15 changes: 12 additions & 3 deletions amp.css
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ p.post-meta {
margin-left: 5px;
}

.fa-svg{
opacity: 0.6;
}
/*
.post-date::before {
content: "公開:";
}
Expand All @@ -216,20 +220,20 @@ p.post-meta {
.category::before{
content: "カテゴリ:";
}

*/
.footer-post-meta{
text-align: right;
font-size: 14px;
}

/*
.footer-post-meta .fa-tag::before{
content: "タグ:";
}
.post-author::before{
content: "著者:";
}

*/
.admin-pv{
text-align: right;
}
Expand Down Expand Up @@ -1103,4 +1107,9 @@ ul.snsbs a.comments-btn-icon-link{background-color:#555;}
.appreach-footer{
margin-bottom: 10px;
clear: left;
}

.fa-fw {
text-align: center;
margin: 0 3px;
}
11 changes: 9 additions & 2 deletions author-link.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?php if ( is_author_visible() && //表示設定されているとき
is_singular() ): //投稿・固定ページのとき ?>
<span class="post-author vcard author"><span class="fn"<?php is_single() ? '' : ''; ?>><span class="fa fa-user fa-fw"></span><?php
is_singular() ): //投稿・固定ページのとき
if (is_amp()) {
$auther_icon_tag = '<amp-img src="'.get_template_directory_uri().'/images/user.svg" width="12" height="12" class="fa fa-svg fa-fw"></amp-img>';
} else {
$auther_icon_tag = '<span class="fa fa-user fa-fw"></span>';
}

?>
<span class="post-author vcard author"><?php echo $auther_icon_tag; ?><span class="fn"<?php is_single() ? '' : ''; ?>><?php
if ( is_twitter_follow_id_author_visible() && get_twitter_follow_id() ): //TwitterID表示の場合 ?>
<a href="https://twitter.com/<?php echo esc_html( get_twitter_follow_id() ); ?>" target="_blank" rel="nofollow">@<?php echo esc_html( get_twitter_follow_id() ); ?></a>
<?php //セキュリティー上の注意表示
Expand Down
15 changes: 11 additions & 4 deletions datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@
////////////////////////////////
$human_time_diff = '';
$mtime = get_mtime('c');
if (is_amp()) {
$clock_icon_tag = '<amp-img src="'.get_template_directory_uri().'/images/clock-o.svg" width="12" height="12" class="fa fa-svg fa-fw"></amp-img>';
$history_icon_tag = '<amp-img src="'.get_template_directory_uri().'/images/history.svg" width="12" height="12" class="fa fa-svg fa-fw"></amp-img>';
} else {
$clock_icon_tag = '<span class="fa fa-clock-o fa-fw"></span>';
$history_icon_tag = '<span class="fa fa-history fa-fw"></span>';
}
if ( is_human_time_diff_visible() )//時間差を表示するか
$human_time_diff = '<span class="post-human-def-diff">(<span class="post-human-date-diff-in">'.human_time_diff( get_the_time('U'), current_time('timestamp') ).'前</span>)</span>';
if ( (is_seo_date_type_update() || is_seo_date_type_update_only()) && //検索エンジンに更新日を伝える場合
$mtime ): //かつ更新日がある場合?>
<?php if ( is_create_date_visible() && is_seo_date_type_update() ): //投稿日を表示する場合?>
<span class="post-date"><span class="fa fa-clock-o fa-fw"></span><span class="entry-date date published"><?php the_time( get_theme_text_date_format() ) ;?></span><?php echo $human_time_diff; ?></span>
<span class="post-date"><?php echo $clock_icon_tag; ?><span class="entry-date date published"><?php the_time( get_theme_text_date_format() ) ;?></span><?php echo $human_time_diff; ?></span>
<?php endif; //is_create_date_visible?>
<?php if ( is_update_date_visible() ): //更新日を表示する場合?>
<span class="post-update"><span class="fa fa-history fa-fw"></span><time class="entry-date date updated" datetime="<?php echo get_mtime('c'); ?>"><?php echo get_mtime( get_theme_text_date_format() ); ?></time></span>
<span class="post-update"><?php echo $history_icon_tag; ?><time class="entry-date date updated" datetime="<?php echo get_mtime('c'); ?>"><?php echo get_mtime( get_theme_text_date_format() ); ?></time></span>
<?php endif; //is_update_date_visible?>
<?php else: //検索エンジンに投稿日を伝える場合?>
<?php if ( is_create_date_visible() ): //投稿日を表示する場合?>
<span class="post-date"><span class="fa fa-clock-o fa-fw"></span><time class="entry-date date published<?php echo ( $mtime && is_update_date_visible() ? '' : ' updated' ); ?>" datetime="<?php echo get_the_time('c');?>"><?php the_time( get_theme_text_date_format() ) ;?></time><?php echo $human_time_diff; ?></span>
<span class="post-date"><?php echo $clock_icon_tag; ?><time class="entry-date date published<?php echo ( $mtime && is_update_date_visible() ? '' : ' updated' ); ?>" datetime="<?php echo get_the_time('c');?>"><?php the_time( get_theme_text_date_format() ) ;?></time><?php echo $human_time_diff; ?></span>
<?php endif; //is_create_date_visible?>
<?php if ( is_update_date_visible() && //更新日を表示する場合
$mtime ) : //更新日があるどき?>
<span class="post-update"><span class="fa fa-history fa-fw"></span><span class="entry-date date updated"><?php echo get_mtime( get_theme_text_date_format() ); ?></span></span>
<span class="post-update"><?php echo $history_icon_tag; ?><span class="entry-date date updated"><?php echo get_mtime( get_theme_text_date_format() ); ?></span></span>
<?php endif; //is_update_date_visible?>
<?php endif; ?>
2 changes: 1 addition & 1 deletion entry-body.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<p class="footer-post-meta">

<?php if (is_tag_visible()): ?>
<span class="post-tag"><?php the_tags('<span class="fa fa-tag fa-fw"></span>',', '); ?></span>
<span class="post-tag"><?php the_tags('<span class="fa fa-tags fa-fw"></span>',', '); ?></span>
<?php endif; ?>

<?php if ( is_single() ) get_template_part('author-link') //投稿者リンク?>
Expand Down
63 changes: 63 additions & 0 deletions images/amp-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions images/amp-logo2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions images/clock-o.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions images/file-text-o.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 644108e

Please sign in to comment.