Advertisement
scanthe17

content-featured.php

Jul 26th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for displaying featured posts on the front page
  4. *
  5. * @package Catch_Wheels
  6. */
  7. ?>
  8.  
  9. <?php
  10. $show_content = get_theme_mod( 'catch_wheels_featured_content_show', 'hide-content' );
  11. $show_meta = get_theme_mod( 'catch_wheels_featured_content_meta_show', 'show-meta' );
  12. $layout = get_theme_mod( 'catch_wheels_featured_content_layout', 'layout-three' );
  13. ?>
  14.  
  15. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  16. <div class="hentry-inner">
  17. <div class="post-thumbnail">
  18. <a href="<?php the_permalink(); ?>">
  19. <?php
  20. /**
  21. * Add play button on hover if post format is video
  22. */
  23. if ( has_post_format( 'video' ) ) : ?>
  24. <span class="preview-toggle">
  25. <i class="fa fa-play"></i>
  26.  
  27. <span class="view-icon-label screen-reader-text"><?php esc_html_e( 'View', 'catch-wheels-pro' ); ?></span>
  28. </span>
  29. <?php endif; ?>
  30. <?php
  31. if ( has_post_thumbnail() ) {
  32. the_post_thumbnail();
  33. }
  34. else {
  35. $image = '<img src="' . trailingslashit( esc_url( get_template_directory_uri() ) ) . 'assets/images/no-thumb-470x353.jpg"/>';
  36.  
  37. // Get the first image in page, returns false if there is no image.
  38. $first_image = catch_wheels_get_first_image( $post->ID, 'post-thumbnail', '' );
  39.  
  40. // Set value of image as first image if there is an image present in the page.
  41. if ( $first_image ) {
  42. $image = $first_image;
  43. }
  44.  
  45. echo $image;
  46. }
  47. ?>
  48. </a>
  49. </div>
  50.  
  51. <div class="entry-container">
  52. <header class="entry-header">
  53. <?php if ( 'show-meta' === $show_meta ) {
  54. echo '<div class="entry-category">';
  55. catch_wheels_entry_category();
  56. echo '</div>';
  57. } ?>
  58. <?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">','</a></h2>' ); ?>
  59.  
  60. <div class="entry-meta">
  61. <?php echo get_the_date(); ?>
  62. <?php catch_wheels_posted_by(); ?>
  63. </div><!-- .entry-meta -->
  64.  
  65. </header>
  66.  
  67. <?php
  68. if ( 'excerpt' === $show_content ) {
  69. $excerpt = get_the_excerpt();
  70.  
  71. echo '<div class="entry-summary"><p>' . $excerpt . '</p></div><!-- .entry-summary -->';
  72. } elseif ( 'full-content' === $show_content ) {
  73. $content = apply_filters( 'the_content', get_the_content() );
  74. $content = str_replace( ']]>', ']]&gt;', $content );
  75. echo '<div class="entry-content"><p>' . $content . '</p></div><!-- .entry-content -->';
  76. } ?>
  77. </div><!-- .entry-container -->
  78. </div> <!-- .hentry-inner -->
  79. </article>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement