Advertisement
Guest User

content-image.php

a guest
Mar 12th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for displaying featured image content
  4. *
  5. * @package Solid_Construction
  6. */
  7. ?>
  8.  
  9. <?php
  10. $quantity = get_theme_mod( 'solid_construction_featured_content_number', 3 );
  11.  
  12. for ( $i = 1; $i <= $quantity; $i++ ) {
  13. $target = get_theme_mod( 'solid_construction_featured_content_target_' . $i ) ? '_blank' : '_self';
  14.  
  15. $link = get_theme_mod( 'solid_construction_featured_content_link_' . $i ) ? get_theme_mod( 'solid_construction_featured_content_link_' . $i ) : '#';
  16.  
  17. if ( function_exists( 'qtrans_convertURL' ) ) {
  18. $link = qtrans_convertURL( $link );
  19. }
  20.  
  21. echo '
  22. <article id="featured-post-' . esc_attr( $i ) . '" class="hentry featured-image-content"><div class="hentry-inner">';
  23.  
  24. $title = get_theme_mod( 'solid_construction_featured_content_title_' . $i );
  25. if( class_exists( 'Polylang' ) ) {
  26. $title = pll__( $title );
  27. }
  28. $content = get_theme_mod( 'solid_construction_featured_content_content_' . $i );
  29. if( class_exists( 'Polylang' ) ) {
  30. $content = pll__( $content );
  31. }
  32. $more_button = get_theme_mod( 'solid_construction_featured_content_more_button_text_' . $i );
  33. if( class_exists( 'Polylang' ) ) {
  34. $more_button = pll__( $more_button );
  35. }
  36.  
  37.  
  38. $image = get_theme_mod( 'solid_construction_featured_content_image_' . $i ) ? get_theme_mod( 'solid_construction_featured_content_image_' . $i ) : '';
  39.  
  40. echo '
  41. <div class="post-thumbnail">
  42. <a href="' . esc_url( $link ) . '" target="' . esc_attr( $target ) . '">
  43. <img src="' . esc_url( $image ) . '" class="wp-post-image" alt="' . esc_attr( $title ) . '" title="' . esc_attr( $title ) . '">
  44. </a></div>';
  45.  
  46. if ( $title || $content || $more_button ) {
  47. echo '
  48. <div class="entry-container">
  49. <header class="entry-header">';
  50.  
  51. if ( $title ) {
  52. echo '
  53. <h2 class="entry-title">
  54. <a href="' . esc_url( $link ) . '" rel="bookmark" target="' . esc_attr( $target ) . '">' . wp_kses_post( $title ) . '</a>
  55. </h2>';
  56. }
  57.  
  58. echo '</header>';
  59.  
  60. if ( $content || $more_button ) {
  61. if ( $more_button ) {
  62. $content .= '<span class="more-button">
  63. <a class="more-link" href="' . esc_url( $link ) . '" rel="bookmark" target="' . esc_attr( $target ) . '">' . esc_html( $more_button ) . '</a>
  64. </span>';
  65. }
  66.  
  67. echo '<div class="entry-summary">' . wp_kses_post( apply_filters( 'the_content', $content ) ) . '</div><!-- .entry-summary -->';
  68. }
  69.  
  70.  
  71. echo '
  72. </div><!-- .entry-container -->';
  73. }
  74.  
  75. echo '
  76. </div>
  77. </article><!-- .featured-post-' . esc_attr( $i ) . ' -->';
  78. } // End for().
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement