content.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /**
  3. * Template part for displaying posts.
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  6. *
  7. * @package Pen
  8. */
  9. $pen_is_singular = is_singular();
  10. ?>
  11. <article id="post-<?php the_ID(); ?>" <?php echo pen_post_classes(); /* phpcs:ignore */ ?>>
  12. <?php
  13. $background_image_dynamic = pen_content_title_background( $pen_is_singular, get_the_ID() );
  14. ?>
  15. <header class="entry-header<?php echo pen_class_lists( 'header_display_override' ); /* phpcs:ignore */ ?>"<?php if ( $background_image_dynamic ) { echo ' style="background-image:url(' . $background_image_dynamic . ');background-size:cover"'; /* phpcs:ignore */ } ?>>
  16. <?php
  17. if ( $pen_is_singular ) {
  18. the_title( '<h1 class="entry-title">', '</h1>' );
  19. } else {
  20. the_title(
  21. sprintf(
  22. '<h2 class="entry-title%1$s"><a href="%2$s" rel="bookmark">',
  23. pen_class_lists( 'title_display_override' ),
  24. esc_url( get_permalink() )
  25. ),
  26. '</a></h2>'
  27. );
  28. }
  29. echo pen_html_content_information( 'header' ); /* phpcs:ignore */
  30. echo pen_html_share( 'header' ); /* phpcs:ignore */
  31. ?>
  32. </header><!-- .entry-header -->
  33. <?php
  34. pen_sidebar_get( 'sidebar-content-top' );
  35. $thumbnail = '';
  36. $list_type = pen_option_get( 'list_type' );
  37. if ( ! $pen_is_singular && 'masonry' === $list_type ) {
  38. ob_start( 'trim' );
  39. get_template_part( 'partials/content', 'thumbnail' );
  40. $thumbnail = ob_get_clean();
  41. echo $thumbnail; /* phpcs:ignore */
  42. }
  43. ob_start( 'trim' );
  44. if ( $pen_is_singular || ! pen_option_get( 'list_excerpt' ) ) {
  45. the_content(
  46. sprintf(
  47. wp_kses(
  48. /* Translators: %s: Name of current post. */
  49. __( 'Continue reading %s', 'pen' ),
  50. array(
  51. 'span' => array(
  52. 'class' => array(),
  53. ),
  54. )
  55. ),
  56. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  57. )
  58. );
  59. } else {
  60. the_excerpt();
  61. }
  62. $content = ob_get_clean();
  63. ob_start( 'trim' );
  64. if ( $pen_is_singular || 'plain' === $list_type ) {
  65. ob_start( 'trim' );
  66. get_template_part( 'partials/content', 'thumbnail' );
  67. $thumbnail = ob_get_clean();
  68. echo $thumbnail; /* phpcs:ignore */
  69. }
  70. if ( $content ) {
  71. ?>
  72. <div class="pen_content_wrapper">
  73. <?php
  74. echo $content; /* phpcs:ignore */
  75. pen_html_pagination_content();
  76. ?>
  77. </div>
  78. <?php
  79. }
  80. pen_sidebar_get( 'sidebar-content-bottom' );
  81. $classes = trim(
  82. implode(
  83. ' ',
  84. array_filter(
  85. array(
  86. 'entry-content',
  87. trim( pen_class_lists( 'summary_display_override' ) ),
  88. $thumbnail ? 'pen_with_thumbnail' : 'post_without_thumbnail',
  89. )
  90. )
  91. )
  92. );
  93. $content = ob_get_clean();
  94. if ( $content ) {
  95. ?>
  96. <div class="<?php echo esc_attr( $classes ); ?>">
  97. <?php
  98. echo $content; /* phpcs:ignore */
  99. $view = is_singular() ? 'content' : 'list';
  100. if($view=="content"){echo '<div style=" text-align: center; "><img alt="扫我捐助哦" src="http://blog.yoqi.me/wp-content/themes/Jianux/images/donate.gif"></div>';}
  101. echo pen_html_share( 'content' ); /* phpcs:ignore */
  102. echo pen_html_author(); /* phpcs:ignore */
  103. ?>
  104. </div><!-- .entry-content -->
  105. <?php
  106. }
  107. get_template_part( 'partials/content', 'footer' );
  108. echo pen_html_configuration_overview(); /* phpcs:ignore */
  109. if ( $pen_is_singular ) {
  110. pen_html_jump_menu( 'content' );
  111. }
  112. ?>
  113. </article><!-- #post-<?php the_ID(); ?> -->