content-page.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * Template part for displaying page content in page.php.
  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. the_title(
  18. sprintf(
  19. '<h1 class="entry-title%s">',
  20. pen_class_lists( 'title_display_override' )
  21. ),
  22. '</h1>'
  23. );
  24. echo pen_html_share( 'header' ); /* phpcs:ignore */
  25. ?>
  26. </header><!-- .entry-header -->
  27. <?php
  28. pen_sidebar_get( 'sidebar-content-top' );
  29. ob_start( 'trim' );
  30. the_content();
  31. $content = ob_get_clean();
  32. ob_start( 'trim' );
  33. get_template_part( 'partials/content', 'thumbnail' );
  34. $thumbnail = ob_get_clean();
  35. ob_start( 'trim' );
  36. echo $thumbnail; /* phpcs:ignore */
  37. if ( $content ) {
  38. ?>
  39. <div class="pen_content_wrapper">
  40. <?php
  41. echo $content; /* phpcs:ignore */
  42. ?>
  43. </div>
  44. <?php
  45. }
  46. pen_html_pagination_content();
  47. $classes = trim(
  48. implode(
  49. ' ',
  50. array_filter(
  51. array(
  52. 'entry-content',
  53. 'clearfix',
  54. trim( pen_class_lists( 'summary_display_override' ) ),
  55. $thumbnail ? 'pen_has_thumbnail' : 'pen_without_thumbnail',
  56. )
  57. )
  58. )
  59. );
  60. $content = ob_get_clean();
  61. if ( $content ) {
  62. ?>
  63. <div class="<?php echo esc_attr( $classes ); ?>">
  64. <?php
  65. echo $content; /* phpcs:ignore */
  66. echo pen_html_share( 'content' ); /* phpcs:ignore */
  67. ?>
  68. </div><!-- .entry-content -->
  69. <?php
  70. }
  71. pen_sidebar_get( 'sidebar-content-bottom' );
  72. $edit_link = ( ! $pen_is_singular ) ? get_edit_post_link() : false;
  73. $social_share = pen_html_share( 'footer' );
  74. if ( $edit_link || $social_share ) {
  75. ?>
  76. <footer class="entry-footer<?php echo pen_class_lists( 'footer_display_override' ); /* phpcs:ignore */ ?>">
  77. <div class="pen_actions">
  78. <?php
  79. if ( $edit_link ) {
  80. edit_post_link(
  81. sprintf(
  82. /* Translators: %s: Name of current post */
  83. esc_html__( 'Edit %s', 'pen' ),
  84. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  85. ),
  86. '<span class="edit-link">',
  87. '</span>'
  88. );
  89. }
  90. echo $social_share; /* phpcs:ignore */
  91. ?>
  92. </div>
  93. </footer><!-- .entry-footer -->
  94. <?php
  95. }
  96. echo pen_html_configuration_overview(); /* phpcs:ignore */
  97. if ( $pen_is_singular ) {
  98. pen_html_jump_menu( 'content' );
  99. }
  100. ?>
  101. </article><!-- #post-<?php the_ID(); ?> -->