content-single.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Template part for displaying posts.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Akina
  8. */
  9. $ai_excerpt = get_post_meta($post->ID, POST_METADATA_KEY, true);
  10. $excerpt = has_excerpt();
  11. ?>
  12. <?php
  13. $post = get_post();
  14. if (iro_opt('article_auto_toc', 'true') && (check_title_tags($post->post_content))) {
  15. echo '<div class="has-toc have-toc"></div>';
  16. }
  17. ?>
  18. <?php
  19. $author_description = '';
  20. if (iro_opt('author_profile_quote') == '1') {
  21. $author_meta = get_the_author_meta( 'description' );
  22. $author_description = $author_meta ? $author_meta :iro_opt('author_profile_quote_text', 'Carpe Diem and Do what I like');
  23. } ?>
  24. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  25. <?php if(should_show_title()) { ?>
  26. <header class="entry-header">
  27. <h1 class="entry-title"><?php the_title(); ?></h1>
  28. <p class="entry-census"><?php echo poi_time_since(strtotime($post->post_date)); ?>&nbsp;&nbsp;<?php echo get_post_views(get_the_ID()).' '. _n('View','Views',get_post_views(get_the_ID()),'sakurairo')/*次阅读*/?> </p>
  29. <hr>
  30. </header><!-- .entry-header -->
  31. <?php } ?>
  32. <!--<div class="toc-entry-content"><!-- 套嵌目录使用(主要为了支援评论)-->
  33. <?php if(!empty($ai_excerpt) && empty($excerpt)) { ?>
  34. <div class="ai-excerpt">
  35. <h4><i class="fa-regular fa-lightbulb"></i><?php _e("AI Excerpt", "sakurairo") ?></h4><?php echo $ai_excerpt; ?>
  36. </div>
  37. <?php } ?>
  38. <div class="entry-content">
  39. <?php the_content(); ?>
  40. <?php
  41. wp_link_pages( array(
  42. 'before' => '<div class="page-links">' . __( 'Pages:', 'ondemand' ),
  43. 'after' => '</div>',
  44. ) );
  45. ?>
  46. <!--<div class="oshimai"></div>-->
  47. <!--<h2 style="opacity:0;max-height:0;margin:0">Comments</h2>--><!-- 评论跳转标记 -->
  48. </div><!-- .entry-content -->
  49. <footer class="post-footer">
  50. <div class="post-lincenses">
  51. <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="nofollow">
  52. <i class="fa-brands fa-creative-commons"></i>
  53. </a>
  54. </div>
  55. <?php the_reward(); ?>
  56. <section class="author-profile">
  57. <?php
  58. $author_id = get_the_author_meta('ID');
  59. $author_url = esc_url(get_author_posts_url($author_id));
  60. $author_name = get_the_author();
  61. ?>
  62. <div class="info" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
  63. <a href="<?= $author_url; ?>" class="profile gravatar">
  64. <img class="fa-spin" style="--fa-animation-duration: 15s;" src="<?php echo get_avatar_profile_url(); ?>" itemprop="image" alt="<?= $author_name; ?>" height="30" width="30">
  65. </a>
  66. </div>
  67. <div class="meta">
  68. <a href="<?= $author_url; ?>" itemprop="url" rel="author"><?= $author_name; ?></a>
  69. </div>
  70. <?php if($author_description){?>
  71. <div class="desc">
  72. <i class="fa-solid fa-feather" aria-hidden="true"></i><?= $author_description ?>
  73. </div>
  74. <?php } ?>
  75. </section>
  76. <div class="post-modified-time">
  77. <i class="fa-solid fa-calendar-day" aria-hidden="true"></i><?php _e('Last updated on ', 'sakurairo'); echo get_the_modified_time('Y-m-d'); ?>
  78. </div>
  79. <div class="post-tags">
  80. <?php if ( has_tag() ) {
  81. echo '<i class="fa-solid fa-tag" aria-hidden="true"></i> ';
  82. the_tags('', ' ', ' ');
  83. } else {
  84. echo '<i class="fa-solid fa-tag" aria-hidden="true"></i> ';
  85. _e('Nothing~', 'sakurairo');
  86. } ?>
  87. </div>
  88. </footer><!-- .entry-footer -->
  89. </article><!-- #post-## -->