Advertisement
Guest User

custom-header-highlight

a guest
Apr 19th, 2022
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None
  1. <?php
  2. /**
  3. * The template for displaying header_highlight items
  4. *
  5. * @package Travelore
  6. */
  7. ?>
  8.  
  9. <?php
  10. $number = get_theme_mod( 'travelore_header_highlight_number', 5 );
  11.  
  12. if ( ! $number ) {
  13. // If number is 0, then this section is disabled
  14. return;
  15. }
  16.  
  17. $disable_slider = ! get_theme_mod( 'travelore_header_highlight_slider' );
  18.  
  19. for ( $i = 1; $i <= $number; $i++ ) {
  20. $content = get_theme_mod( 'travelore_header_highlight_content_' . $i );
  21. $target = get_theme_mod( 'travelore_header_highlight_target_' . $i ) ? '_blank': '_self';
  22. $link = get_theme_mod( 'travelore_header_highlight_link_' . $i, '#' );
  23. $title = get_theme_mod( 'travelore_header_highlight_title_' . $i );
  24. $image = get_theme_mod( 'travelore_header_highlight_image_' . $i );
  25.  
  26. if ( function_exists( 'qtrans_convertURL' ) ) {
  27. $link = qtrans_convertURL( $link );
  28. }
  29.  
  30. $post_class = '';
  31. if ( has_post_thumbnail() ) {
  32. $post_class .= ' has-post-thumbnail';
  33. }
  34.  
  35. ?>
  36. <article id="header-highlights-post-<?php echo esc_attr( $i ) ?>" class="grid-item post hentry post-image <?php echo esc_attr( $post_class ); ?>">
  37. <div class="hentry-inner">
  38. <?php if ( $image ) : ?>
  39. <div class="header-highlight-section-thumbnail post-thumbnail" style="background-image: url( <?php echo esc_url( $image ); ?> );">
  40. <a href="<?php echo esc_url( $link ); ?>" class="cover-link">
  41.  
  42. </a>
  43. </div><!-- .post-thumbnail -->
  44. <?php endif; ?>
  45. <div class="entry-container">
  46. <?php if ( $title ) : ?>
  47. <header class="entry-header">
  48. <h2 class="entry-title"><a target="<?php echo esc_attr( $target ); ?>" href="<?php echo esc_url( $link ); ?>"><?php echo wp_kses_post( $title ); ?></a></h2>
  49. </header>
  50. <?php endif; ?>
  51.  
  52. <?php if ( $content ) : ?>
  53. <div class="entry-content">
  54. <?php echo wp_kses_post( apply_filters( 'the_content', $content ) ); ?>
  55. </div>
  56. <?php endif; ?>
  57. </div><!-- .entry-container -->
  58. </div><!-- .hentry-inner -->
  59. </article>
  60. <?php if ( 0 === $i % 5 && $i < $number ) : ?>
  61. </div><!-- grid -->
  62. <?php endif;
  63.  
  64. if ( ! $disable_slider && 0 === $i % 5 && $i < $number ) : ?>
  65. </div><!-- .slider-wrapper -->
  66. <div class="slider-wrapper">
  67. <?php
  68. endif;
  69. if ( 0 === $i % 5 && $i < $number ) : ?>
  70. <div class="grid">
  71. <div class="grid-sizer"></div>
  72. <?php endif;
  73. }
  74.  
Advertisement
RAW Paste Data Copied
Advertisement