function oxy_shortcode_service($atts, $content = '') { $output = ''; if (isset($atts['service']) && !empty($atts['service'])) { $query = array('post_type' => 'oxy_service', 'posts_per_page' => 1, 'name' => $atts['service'], 'post_status' => 'publish'); // get the service $query = new WP_Query($query); $services = $query->get_posts(); if (count($services) > 0) { $output = oxy_create_service($services[0], $atts); } } // reset post data because we are all done here wp_reset_postdata(); return $output; }
<div class="list-container <?php echo esc_attr(implode(' ', $wrapper_classes)); ?> " data-os-animation="<?php echo esc_attr($atts['scroll_animation']); ?> " data-os-animation-delay="<?php echo esc_attr($atts['scroll_animation_delay']); ?> s"> <?php foreach ($services as $post) { $atts['extra_classes'] = 'col-md-' . $atts['columns']; $atts['margin_top'] = 0; $atts['margin_bottom'] = 20; echo oxy_create_service($post, $atts); if ($atts['scroll_animation_timing'] === 'staggered') { $atts['scroll_animation_delay'] += $item_delay; } } ?> </div>