function oxy_shortcode_recent($atts, $content = '') { // setup options extract(shortcode_atts(array('count' => 4, 'categories' => null, 'authors' => null, 'post_formats' => null, 'titles' => 'show'), $atts)); $categories = null === $categories ? null : explode(',', $categories); $authors = null === $authors ? null : explode(',', $authors); $post_formats = null === $post_formats ? null : explode(',', $post_formats); $posts = oxy_get_recent_posts($count, $categories, $authors, $post_formats); $output = ''; if (!empty($posts)) { $output .= '[raw]<ul class="oxyrecentposts">'; global $post; foreach ($posts as $post) { setup_postdata($post); $output .= '<li>'; $output .= '<a href="' . get_permalink() . '" class="recent-feature" >'; if (has_post_thumbnail($post->ID)) { $output .= get_the_post_thumbnail($post->ID, array(64, 64), array('title' => $post->post_title, 'alt' => $post->post_title)); } else { // $output .= oxy_theme_icon( oxy_get_post_icon( $post->ID ), 'span' ); } $output .= '</a>'; if ('show' == $titles) { $output .= '<h5>' . get_the_title($post->ID) . '</h5>'; $output .= '<p>' . get_the_date() . '</p>'; } $output .= '</li>'; } $output .= '</ul>[/raw]'; } // reset post data wp_reset_postdata(); return $output; }
function oxy_posts_slideshow($atts, $content = '') { // setup options extract(shortcode_atts(array('count' => '3', 'cat' => null, 'animation_type' => 'slide', 'speed' => '7000', 'show_controls' => 'show', 'directionnav' => 'hide', 'title_tag' => 'h3', 'text_align' => 'left', 'item_caption_vertical' => 'bottom', 'item_hover_filter' => 'none', 'hover_effect' => '', 'extra_classes' => '', 'margin_top' => '20', 'margin_bottom' => '20', 'scroll_animation' => 'none', 'scroll_animation_delay' => '0', 'hidden_on_large' => 'off', 'hidden_on_medium' => 'off', 'hidden_on_small' => 'off', 'hidden_on_xsmall' => 'off'), $atts)); // classes applied to the flexslider $container_classes = array(); $container_classes[] = 'flexslider'; $container_classes[] = 'element-top-' . $margin_top; $container_classes[] = 'element-bottom-' . $margin_bottom; $container_classes[] = 'text-' . $text_align; $container_classes[] = oxy_add_extra_shortcode_classes($atts); if ($scroll_animation !== 'none') { $container_classes[] = 'os-animation'; } //classes applied per post basis $classes = array(); $classes[] = 'figcaption-' . $item_caption_vertical; $classes[] = 'text-' . $text_align; $classes[] = 'image-filter-' . $item_hover_filter; $classes[] = $hover_effect; $item_delay = $scroll_animation_delay; $cat = null === $cat ? null : explode(',', $cat); $posts = oxy_get_recent_posts($count, $cat); global $post; $output = ''; if (!empty($posts)) { ob_start(); include locate_template('partials/shortcodes/posts/slideshow.php'); $output .= ob_get_contents(); ob_end_clean(); } // reset post data wp_reset_postdata(); wp_reset_query(); return $output; }
function oxy_shortcode_recent_simple($atts, $content = '') { // setup options extract(shortcode_atts(array('count' => 3, 'cat' => null, 'columns' => 3, 'scroll_animation_timing' => 'staggered', 'extra_classes' => '', 'margin_top' => 'normal-top', 'margin_bottom' => 'normal-bottom', 'scroll_animation' => 'none', 'scroll_animation_delay' => 0), $atts)); $span_width = $columns > 0 ? floor(12 / $columns) : 4; $classes = array(); $container_classes = array(); $container_classes[] = $extra_classes; $container_classes[] = 'row'; $container_classes[] = 'element-' . $margin_top; $container_classes[] = 'element-' . $margin_bottom; $container_classes[] = 'recent-simple-os-container'; $classes[] = 'col-md-' . $span_width; if ($scroll_animation !== 'none') { $classes[] = 'recent-simple-os-animation'; } $item_delay = $scroll_animation_delay; $cat = null === $cat ? null : explode(',', $cat); $posts = oxy_get_recent_posts($count, $cat); global $post; $output = ''; if (!empty($posts)) { ob_start(); include locate_template('partials/shortcodes/posts/simple.php'); $output .= ob_get_contents(); ob_end_clean(); } // reset post data wp_reset_postdata(); wp_reset_query(); return $output; }