<?php /** * INDEX - SLIDER */ $slider_posts = koala_get_slider_posts(); if (count($slider_posts) > 0) { ?> <section class="post-slider"> <span class="previous-post"><i class="fa fa-chevron-left"></i></span> <div class="post-slider-container"> <?php foreach ($slider_posts as $post) { setup_postdata($post); $post_image = null; if (has_post_thumbnail()) { $post_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'background'); $post_image = $post_image[0]; } ?> <article class="post-slider-post" data-background="<?php echo esc_url($post_image); ?> "> <?php koala_get_category(); ?> <h2><a href="<?php the_permalink();
function koala_get_slider_background() { $slider_post = koala_get_slider_posts(1); if (count($slider_post)) { $post_image = null; if (has_post_thumbnail($slider_post[0]->ID)) { $post_image = wp_get_attachment_image_src(get_post_thumbnail_id($slider_post[0]->ID), 'background'); $post_image = $post_image[0]; } return $post_image; } else { return koala_get_header_background(); } }