page-word.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Template Name: 说说模版
  4. */
  5. get_header();
  6. ?>
  7. <div id="primary" class="content-area">
  8. <main id="main" class="site-main" role="main">
  9. <div class="cbp_shuoshuo">
  10. <?php
  11. query_posts("post_type=shuoshuo & post_status=publish & posts_per_page=-1");
  12. if (have_posts()) : ?>
  13. <ul class="cbp_tmtimeline">
  14. <?php
  15. while (have_posts()) : the_post(); ?>
  16. <li>
  17. <span class="shuoshuo_author_img"><img src="<?php echo get_avatar_profile_url(get_the_author_meta('ID')); ?>" class="avatar avatar-48" width="48" height="48"></span>
  18. <div class="cbp_tmlabel">
  19. <p><?php the_content(); ?></p>
  20. <p class="shuoshuo_time"><i class="fa fa-clock-o"></i> <?php the_time('Y年n月j日 G:i'); ?></p>
  21. </div>
  22. </li>
  23. <?php endwhile; ?>
  24. </ul>
  25. <?php
  26. else : ?>
  27. <h3 style="text-align: center;">你还没有发表说说噢!</h3>
  28. <p style="text-align: center;">赶快去发表你的第一条说说心情吧!</p>
  29. <?php
  30. endif; ?>
  31. </div>
  32. </main><!-- #main -->
  33. </div><!-- #primary -->
  34. <script type="text/javascript">
  35. document.addEventListener('DOMContentLoaded', ()=>{
  36. document.querySelectorAll('.cbp_tmtimeline li').forEach((p)=>{
  37. var e = p.querySelector('.shuoshuo_author_img img')
  38. p.addEventListener("mouseenter",()=>{
  39. e.classList.add("zhuan");
  40. })
  41. p.addEventListener("mouseleave",()=>{
  42. e.classList.remove("zhuan");
  43. })
  44. })
  45. }, false);
  46. </script>
  47. <?php
  48. get_footer();
  49. ?>