| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; // Exit if accessed directly. |
| 4 |
} |
| 5 |
|
| 6 |
global $ova_elems_template; |
| 7 |
$ova_elems_template = 'template4'; |
| 8 |
$selected_posts = maybe_unserialize(get_post_meta($post_id, '_ova_elems_selected_posts_template4', true)); |
| 9 |
$_ova_elems_static_settings_template4 = get_post_meta($post_id, '_ova_elems_static_settings_template4', true); |
| 10 |
$_ova_elems_static_settings_template4 = $_ova_elems_static_settings_template4 ? maybe_unserialize($_ova_elems_static_settings_template4) : array(); |
| 11 |
//end |
| 12 |
|
| 13 |
$instagram_url = isset($_ova_elems_static_settings_template4['instagram_url']) ? esc_url($_ova_elems_static_settings_template4['instagram_url']) : ''; |
| 14 |
$youtube_url = isset($_ova_elems_static_settings_template4['youtube_url']) ? esc_url($_ova_elems_static_settings_template4['youtube_url']) : ''; |
| 15 |
$basketball_url = isset($_ova_elems_static_settings_template4['basketball_url']) ? esc_url($_ova_elems_static_settings_template4['basketball_url']) : ''; |
| 16 |
$twitter_url = isset($_ova_elems_static_settings_template4['twitter_url']) ? esc_url($_ova_elems_static_settings_template4['twitter_url']) : ''; |
| 17 |
$mini_description = isset($_ova_elems_static_settings_template4['mini_description']) ? esc_html($_ova_elems_static_settings_template4['mini_description']) : ''; |
| 18 |
$corner_posts_count = isset($_ova_elems_static_settings_template4['corner_posts_count']) ? intval($_ova_elems_static_settings_template4['corner_posts_count']) : 1; |
| 19 |
$autoplay_setting = isset($_ova_elems_static_settings_template4['autoplay_setting']) ? (int) $_ova_elems_static_settings_template4['autoplay_setting'] : 0; |
| 20 |
$autoplay_delay = isset($_ova_elems_static_settings_template4['autoplay_delay']) ? absint($_ova_elems_static_settings_template4['autoplay_delay']) : 1000; |
| 21 |
$effect = isset($_ova_elems_static_settings_template4['effect']) ? sanitize_text_field($_ova_elems_static_settings_template4['effect']) : 'fade'; |
| 22 |
$button_bg_color = isset($_ova_elems_static_settings_template4['button_bg_color']) ? sanitize_hex_color($_ova_elems_static_settings_template4['button_bg_color']) : '#000000'; |
| 23 |
$button_hover_bg_color = isset($_ova_elems_static_settings_template4['button_hover_bg_color']) ? sanitize_hex_color($_ova_elems_static_settings_template4['button_hover_bg_color']) : '#333333'; |
| 24 |
$button_text_color = isset($_ova_elems_static_settings_template4['button_text_color']) ? sanitize_hex_color($_ova_elems_static_settings_template4['button_text_color']) : '#ffffff'; |
| 25 |
$button_hover_text_color = isset($_ova_elems_static_settings_template4['button_hover_text_color']) ? sanitize_hex_color($_ova_elems_static_settings_template4['button_hover_text_color']) : '#ffffff'; |
| 26 |
$social_icon_active_color = isset($_ova_elems_static_settings_template4['social_icon_active_color']) ? sanitize_hex_color($_ova_elems_static_settings_template4['social_icon_active_color']) : '#3b5998'; |
| 27 |
$social_icon_hover_color = isset($_ova_elems_static_settings_template4['social_icon_hover_color']) ? sanitize_hex_color($_ova_elems_static_settings_template4['social_icon_hover_color']) : '#2d4373'; |
| 28 |
$social_icon_size = isset($_ova_elems_static_settings_template4['social_icon_size']) ? absint($_ova_elems_static_settings_template4['social_icon_size']) : 24; |
| 29 |
$custom_css = isset($_ova_elems_static_settings_template4['custom_css']) ? sanitize_textarea_field($_ova_elems_static_settings_template4['custom_css']) : ''; |
| 30 |
|
| 31 |
//print_r($corner_posts_count); |
| 32 |
|
| 33 |
|
| 34 |
$corner_posts_category = isset($_ova_elems_static_settings_template4['corner_posts_category']) ? intval($_ova_elems_static_settings_template4['corner_posts_category']) : ''; |
| 35 |
$corner_posts_order = isset($_ova_elems_static_settings_template4['corner_posts_order']) ? sanitize_text_field($_ova_elems_static_settings_template4['corner_posts_order']) : 'asc'; |
| 36 |
|
| 37 |
// Fetch corner posts |
| 38 |
$corner_posts = new WP_Query( |
| 39 |
array( |
| 40 |
'post_type' => 'post', |
| 41 |
'posts_per_page' => $corner_posts_count, |
| 42 |
'cat' => $corner_posts_category, |
| 43 |
'order' => $corner_posts_order, |
| 44 |
'orderby' => 'date' |
| 45 |
) |
| 46 |
|
| 47 |
|
| 48 |
); |
| 49 |
$dynamic_settings = [ |
| 50 |
'effect' => $_ova_elems_static_settings_template4['effect'] ?? 'fade', |
| 51 |
'crossFade' => !empty($_ova_elems_static_settings_template4['fade_crossfade']), |
| 52 |
'lazyLoad' => !empty($_ova_elems_static_settings_template4['lazy_load']) && $_ova_elems_static_settings_template4['lazy_load'] == '1' ? true : false, |
| 53 |
'autoplay' => isset($_ova_elems_static_settings_template4['autoplay_setting']) ? $_ova_elems_static_settings_template4['autoplay_setting'] == 1 : false, |
| 54 |
'autoplay_delay' => isset($_ova_elems_static_settings_template4['autoplay_delay']) ? absint($_ova_elems_static_settings_template4['autoplay_delay']) : 1000, |
| 55 |
]; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
wp_enqueue_style('ova-elems-style4', OVA_ELEMS_URL . 'assets/css/style4.css', array(), OVA_ELEMS_VER); |
| 60 |
wp_enqueue_script('ova-elems-template-4-frontend-scripts', OVA_ELEMS_URL . 'assets/js/template-4-scripts.js', array('jquery'), OVA_ELEMS_VER, true); |
| 61 |
// Override the default Font Awesome version for template 4 |
| 62 |
wp_dequeue_style('font-awesome'); |
| 63 |
wp_enqueue_style('ova-elems-font-awesome-template4', OVA_ELEMS_URL . 'assets/css/font.all.min.css', array(), OVA_ELEMS_VER); |
| 64 |
// Localize the script |
| 65 |
wp_localize_script('ova-elems-template-4-frontend-scripts', 'template4SliderConfig', $dynamic_settings); |
| 66 |
?> |
| 67 |
|
| 68 |
<section class="oe-news-slider"> |
| 69 |
<div class="oe-inner-wrap"> |
| 70 |
<div class="social-media-wrap"> |
| 71 |
<div class="oe-icons-container"> |
| 72 |
<div class="icons"><a |
| 73 |
href="<?php echo esc_url($_ova_elems_static_settings_template4['facebook_url'] ?? '#'); ?>" target="_blank"><i |
| 74 |
class="fa-brands fa-facebook-f"></i></a></div> |
| 75 |
<div class="icons"><a |
| 76 |
href="<?php echo esc_url($_ova_elems_static_settings_template4['instagram_url'] ?? '#'); ?>" target="_blank"><i |
| 77 |
class="fa-brands fa-instagram"></i></a></div> |
| 78 |
<div class="icons"><a |
| 79 |
href="<?php echo esc_url($_ova_elems_static_settings_template4['youtube_url'] ?? '#'); ?>" target="_blank"><i |
| 80 |
class="fa-brands fa-youtube"></i></a></div> |
| 81 |
<div class="icons"><a |
| 82 |
href="<?php echo esc_url($_ova_elems_static_settings_template4['basketball_url'] ?? '#'); ?>" target="_blank"><i |
| 83 |
class="fa-solid fa-basketball"></i></a></div> |
| 84 |
<div class="icons"><a |
| 85 |
href="<?php echo esc_url($_ova_elems_static_settings_template4['twitter_url'] ?? '#'); ?>" target="_blank"><i |
| 86 |
class="fa-brands fa-twitter"></i></a></div> |
| 87 |
</div> |
| 88 |
<div class="follow-title ov-social-news"> |
| 89 |
<?php echo esc_html($_ova_elems_static_settings_template4['ov_template_review_text'] ?? ''); ?> |
| 90 |
</div> |
| 91 |
</div> |
| 92 |
|
| 93 |
<div class="slide-outer"> |
| 94 |
<!-- Slider content --> |
| 95 |
<div class="swiper"> |
| 96 |
<div class="swiper-wrapper"> |
| 97 |
<?php |
| 98 |
// Generate slides dynamically |
| 99 |
if (!empty($selected_posts)) { |
| 100 |
foreach ($selected_posts as $post_id) { |
| 101 |
$post = get_post($post_id); |
| 102 |
if ($post) { |
| 103 |
|
| 104 |
$thumbnail = get_the_post_thumbnail_url($post_id, 'large'); |
| 105 |
|
| 106 |
$post_author = get_the_author_meta('display_name', $post->post_author); |
| 107 |
$post_date = get_the_date('d-M-Y', $post_id); |
| 108 |
$post_time = get_the_time('H:i', $post_id); |
| 109 |
$post_content = apply_filters('the_content', $post->post_content); |
| 110 |
|
| 111 |
?> |
| 112 |
|
| 113 |
<div class="swiper-slide" style="background-image: url('<?php echo esc_url($thumbnail); ?>');"> |
| 114 |
<div class="content-wrapper"> |
| 115 |
<!-- new add for title description characters limit --> |
| 116 |
|
| 117 |
<div class="offer-tag set-offer-font"> |
| 118 |
<?php |
| 119 |
$title = esc_html($post->post_title); |
| 120 |
$title = wp_trim_words($title, 10, '...'); |
| 121 |
echo esc_html($title); |
| 122 |
?> |
| 123 |
</div> |
| 124 |
|
| 125 |
<h1 class="heading slide-tittle"> |
| 126 |
<?php |
| 127 |
$title = esc_html($post->post_title); |
| 128 |
$title = wp_trim_words($title, 10, '...'); |
| 129 |
// echo $title; |
| 130 |
echo '<a href="' . esc_url(get_permalink($post->ID)) . '" class="post-title-link">' . esc_html($title) . '</a>'; |
| 131 |
?> |
| 132 |
</h1> |
| 133 |
|
| 134 |
<div class="theme-para slide-desc"> |
| 135 |
<?php |
| 136 |
// Limit post description to 150 characters, or set your own limit |
| 137 |
$content = apply_filters('the_content', $post->post_content); |
| 138 |
$content = wp_strip_all_tags($content); // Remove HTML tags |
| 139 |
$content = mb_strimwidth($content, 0, 150, '...'); // Limit to 150 characters with ellipsis |
| 140 |
echo esc_html($content); |
| 141 |
?> |
| 142 |
</div> |
| 143 |
|
| 144 |
|
| 145 |
<!-- end --> |
| 146 |
|
| 147 |
|
| 148 |
<div class="slider-meta"> |
| 149 |
<div class="meta-item"> |
| 150 |
<span class="item"> |
| 151 |
<i class="fa-solid fa-user"></i> |
| 152 |
</span> |
| 153 |
<p class="text slide-content"><?php echo esc_html($post_author); ?></p> |
| 154 |
</div> |
| 155 |
<div class="meta-item"> |
| 156 |
<span class="item"> |
| 157 |
<i class="fa-solid fa-calendar"></i> |
| 158 |
</span> |
| 159 |
<p class="text slide-content"><?php echo esc_html($post_date); ?></p> |
| 160 |
</div> |
| 161 |
<div class="meta-item"> |
| 162 |
<span class="item"> |
| 163 |
<i class="fa-solid fa-clock"></i> |
| 164 |
</span> |
| 165 |
<p class="text slide-content"><?php echo esc_html($post_time); ?></p> |
| 166 |
</div> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
<?php |
| 171 |
} |
| 172 |
} |
| 173 |
} |
| 174 |
?> |
| 175 |
</div> |
| 176 |
|
| 177 |
<!-- Navigation --> |
| 178 |
|
| 179 |
<div class="swiper-pagination"></div> |
| 180 |
</div> |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
<div class="slider-nav"> |
| 185 |
<div class="slider-swipper-buttons"> |
| 186 |
<div class="swiper-button-next"></div> |
| 187 |
<div class="swiper-button-prev"></div> |
| 188 |
</div> |
| 189 |
|
| 190 |
<?php |
| 191 |
// Example navigation items (use real URLs or image sources) |
| 192 |
?> |
| 193 |
<div class="oe-slider-controls"> |
| 194 |
<a href="#"><i class="fa-solid fa-chevron-left"></i></a> |
| 195 |
<a href="#"><i class="fa-solid fa-chevron-right"></i></a> |
| 196 |
</div> |
| 197 |
<?php foreach ($selected_posts as $post_id): ?> |
| 198 |
<div class="nav-item"> |
| 199 |
<div class="nav-item-img"> |
| 200 |
<?php |
| 201 |
// Fetch post thumbnail or a default image |
| 202 |
$thumbnail = get_the_post_thumbnail_url($post_id, 'thumbnail'); |
| 203 |
?> |
| 204 |
<img src="<?php echo esc_url($thumbnail ?: 'default-image-url'); ?>" alt=""> |
| 205 |
<i class="fa-solid fa-expand"></i> |
| 206 |
</div> |
| 207 |
</div> |
| 208 |
<?php endforeach; ?> |
| 209 |
</div> |
| 210 |
<div class="banner-below"> |
| 211 |
<div class="text"> |
| 212 |
<p class="description ov-mini-title"> |
| 213 |
<?php echo esc_html($_ova_elems_static_settings_template4['mini_description']); ?> |
| 214 |
</p> |
| 215 |
</div> |
| 216 |
|
| 217 |
</div> |
| 218 |
</div> |
| 219 |
</div> |
| 220 |
<div class="recent-news-sidebar"> |
| 221 |
<div class="sidebar-heading"> |
| 222 |
<h3>Recent News</h3> |
| 223 |
</div> |
| 224 |
<div class="news-outer"> |
| 225 |
<?php |
| 226 |
// Display corner posts |
| 227 |
if ($corner_posts->have_posts()) { |
| 228 |
while ($corner_posts->have_posts()) { |
| 229 |
$corner_posts->the_post(); |
| 230 |
?> |
| 231 |
<div class="news-item"> |
| 232 |
<div class="news-item-img"> |
| 233 |
<?php |
| 234 |
$news_thumbnail = get_the_post_thumbnail_url(get_the_ID(), 'thumbnail'); |
| 235 |
?> |
| 236 |
<img src="<?php echo esc_url($news_thumbnail ?: 'default-news-image-url'); ?>" |
| 237 |
alt="news feature image"> |
| 238 |
</div> |
| 239 |
<div class="news-intem-inner"> |
| 240 |
|
| 241 |
<h4 class="title ov-right-news-tittle"> |
| 242 |
<a href="<?php the_permalink(); ?>" class="post-title-link"> |
| 243 |
<?php |
| 244 |
$title = get_the_title(); |
| 245 |
$title = wp_trim_words($title, 9, '...'); |
| 246 |
echo esc_html($title); |
| 247 |
?> |
| 248 |
</a> |
| 249 |
</h4> |
| 250 |
<div class="news-meta"> |
| 251 |
<div class="news-meta-item"> |
| 252 |
<span class="news-item-icon"> |
| 253 |
<i class="fa-solid fa-user"></i> |
| 254 |
</span> |
| 255 |
<p class="news-text slide-content"><?php the_author(); ?></p> |
| 256 |
</div> |
| 257 |
<div class="news-meta-item"> |
| 258 |
<span class="news-item-icon"> |
| 259 |
<i class="fa-solid fa-calendar"></i> |
| 260 |
</span> |
| 261 |
<p class="news-text slide-content"><?php echo get_the_date('d-M-Y'); ?></p> |
| 262 |
</div> |
| 263 |
</div> |
| 264 |
</div> |
| 265 |
</div> |
| 266 |
<?php |
| 267 |
} |
| 268 |
wp_reset_postdata(); |
| 269 |
} |
| 270 |
?> |
| 271 |
</div> |
| 272 |
<div class="live-reporting"> |
| 273 |
<div class="live-reporting-inner"> |
| 274 |
<a href="<?php echo esc_url($_ova_elems_static_settings_template4['live_video_link'] ?? '#'); ?>" |
| 275 |
class="play-btn"><i class="fa-solid fa-play"></i></a> |
| 276 |
<div class="live-inner"> |
| 277 |
<small |
| 278 |
class="live_mini_text_font_size"><?php echo esc_html($_ova_elems_static_settings_template4['live_mini_text']); ?></small> |
| 279 |
<p class="live_title_font_size"> |
| 280 |
<?php echo esc_html($_ova_elems_static_settings_template4['live_title_text']); ?></p> |
| 281 |
</div> |
| 282 |
</div> |
| 283 |
|
| 284 |
</div> |
| 285 |
</div> |
| 286 |
|
| 287 |
</section> |