content-none.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Template part for displaying a message that posts cannot be found.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Akina
  8. */
  9. ?>
  10. <section class="no-results not-found">
  11. <header class="page-header">
  12. <h1 class="page-title"><?php _e( 'There is nothing here!', 'sakurairo' ); /*没有找到任何东西*/?></h1>
  13. </header><!-- .page-header -->
  14. <div class="page-content">
  15. <?php
  16. if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
  17. <p><?php printf( wp_kses( __( 'Ready to post your first article? <a href="%1$s">Click here to start</a>.', 'sakurairo' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); /*准备好发布你的第一篇文章了么? <a href="%1$s">点击这里开始</a>.*/?></p>
  18. <?php elseif ( is_search() ) : ?>
  19. <div class="sorry">
  20. <p><?php _e( 'Didn\'t find what you want, look at the other ones.', 'sakurairo' ); /*没有找到你想要的,看看其他的吧。*/?></p>
  21. <div class="sorry-inner">
  22. <ul class="search-no-reasults">
  23. <?php
  24. $result = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts where post_status='publish' and post_type='post' ORDER BY ID DESC LIMIT 0 , 20");
  25. foreach ($result as $post) {
  26. setup_postdata($post);
  27. $postid = $post->ID;
  28. $title = $post->post_title;
  29. ?>
  30. <li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"><?php echo $title ?></a> </li>
  31. <?php } ?>
  32. </ul>
  33. </div>
  34. </div>
  35. <?php else : ?>
  36. <p><?php _e( 'We didn\'t seem to find what you want. Maybe you can search for it.', 'sakurairo' ); /*我们似乎没有找到你想要的东西. 或许你可以搜索一下试试.*/?></p>
  37. <?php
  38. endif; ?>
  39. </div><!-- .page-content -->
  40. </section><!-- .no-results -->