Advertisement
Guest User

read-more-button

a guest
Feb 5th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. function catcheverest_homepage_featured_content() {
  2. //delete_transient( 'catcheverest_homepage_featured_content' );
  3.  
  4. // Getting data from Theme Options
  5. global $catcheverest_options_settings;
  6. $options = $catcheverest_options_settings;
  7. $disable_homepage_featured = $options['disable_homepage_featured'];
  8. $quantity = $options['homepage_featured_qty'];
  9. $headline = $options['homepage_featured_headline'];
  10. $layouts = $options['homepage_featured_layout'];
  11.  
  12. if ( $disable_homepage_featured == "0" ) {
  13.  
  14. if ( !$catcheverest_homepage_featured_content = get_transient( 'catcheverest_homepage_featured_content' ) && ( !empty( $options['homepage_featured_image'] ) || !empty( $options['homepage_featured_title'] ) || !empty( $options['homepage_featured_content'] ) ) ) {
  15.  
  16. echo '<!-- refreshing cache -->';
  17.  
  18. //Checking Layout
  19. if ( 'four-columns' == $layouts ) {
  20. $parentclasses = "layout-four";
  21. }
  22. else {
  23. $parentclasses = "layout-three";
  24. }
  25.  
  26. $catcheverest_homepage_featured_content = '<section id="featured-post" class="' . $parentclasses . '">';
  27.  
  28. if ( !empty( $headline ) ) {
  29. $catcheverest_homepage_featured_content .= '<h2 id="feature-heading" class="entry-title">' . wp_kses_post( $headline ) . '</h2>';
  30. }
  31.  
  32. $catcheverest_homepage_featured_content .= '<div class="featued-content-wrap">';
  33.  
  34. for ( $i = 1; $i <= $quantity; $i++ ) {
  35.  
  36. //Adding in Classes for Display blok and none
  37. if ( 'four-columns' == $layouts ) {
  38. if ( $i % 4 == 1 || $i == 1 ) {
  39. $classes = "post hentry first";
  40. }
  41. else {
  42. $classes = "post hentry";
  43. }
  44.  
  45. }
  46. elseif ( $i % 3 == 1 || $i == 1 ) {
  47. $classes = "post hentry first";
  48. }
  49. else {
  50. $classes = "post hentry";
  51. }
  52.  
  53. //Checking Title
  54. if ( !empty ( $options['homepage_featured_title'][ $i ] ) ) {
  55. $title = $options['homepage_featured_title'][ $i ];
  56. } else {
  57. $title = '';
  58. }
  59.  
  60. //Checking Link
  61. if ( !empty ( $options['homepage_featured_url'][ $i ] ) ) {
  62.  
  63. //support qTranslate plugin
  64. if ( function_exists( 'qtrans_convertURL' ) ) {
  65. $link = qtrans_convertURL($options['homepage_featured_url'][ $i ]);
  66. }
  67. else {
  68. $link = $options['homepage_featured_url'][ $i ];
  69. }
  70.  
  71. if ( !empty ( $options['homepage_featured_base'][ $i ] ) ) {
  72. $target = '_blank';
  73. } else {
  74. $target = '_self';
  75. }
  76. $linkopen = '<a title="' . esc_attr( $title ) . '" href="' . esc_url( $link ) . '" target="' . $target . '">';
  77. $linkclose = '</a>';
  78. } else {
  79. $link = '';
  80. $target = '';
  81. $linkopen = '';
  82. $linkclose = '';
  83. }
  84.  
  85. if ( !empty ( $options['homepage_featured_title'][ $i ] ) || !empty ( $options['homepage_featured_content'][ $i ] ) || !empty ( $options['homepage_featured_image'][ $i ] ) ) {
  86. $catcheverest_homepage_featured_content .= '
  87. <article id="featured-post-'.$i.'" class="'.$classes.'">';
  88. if ( !empty ( $options['homepage_featured_image'][ $i ] ) ) {
  89. $catcheverest_homepage_featured_content .= '
  90. <figure class="featured-homepage-image">
  91. ' . $linkopen . '
  92. <img src="'.$options['homepage_featured_image'][ $i ].'" class="wp-post-image" alt="' . esc_attr( $title ) . '" title="' . esc_attr( $title ) . '">
  93. ' . $linkclose . '
  94. </figure>';
  95. }
  96. if ( !empty ( $options['homepage_featured_title'][ $i ] ) || !empty ( $options['homepage_featured_content'][ $i ] ) ) {
  97. $catcheverest_homepage_featured_content .= '
  98. <div class="entry-container">';
  99.  
  100. if ( !empty ( $options['homepage_featured_title'][ $i ] ) ) {
  101. $catcheverest_homepage_featured_content .= '
  102. <header class="entry-header">
  103. <h2 class="entry-title">
  104. ' . $linkopen . $title . $linkclose . '
  105. </h2>
  106. ' . catcheverest_featured_meta($options['homepage_featured_author'][ $i ]) . '
  107. </header>';
  108. }
  109. if ( !empty ( $options['homepage_featured_content'][ $i ] ) ) {
  110. $catcheverest_homepage_featured_content .= '
  111. <div class="entry-content">
  112. ' . $options['homepage_featured_content'][ $i ] . $linkopen . ' Read more...' . $linkclose. '
  113. </div>';
  114. }
  115. $catcheverest_homepage_featured_content .= '
  116. </div><!-- .entry-container -->';
  117. }
  118. $catcheverest_homepage_featured_content .= '
  119. </article><!-- .slides -->';
  120. }
  121.  
  122. }
  123.  
  124. $catcheverest_homepage_featured_content .= '</div><!-- .featued-content-wrap -->';
  125.  
  126. $catcheverest_homepage_featured_content .= '</section><!-- #featured-post -->';
  127.  
  128. }
  129.  
  130. echo $catcheverest_homepage_featured_content;
  131.  
  132. }
  133.  
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement