function alaya_scrolling_posts($title = 'The Latest Posts', $columns = 3, $header = "horizontal", $number = 6, $category_slug = '', $only_sticky) { global $post, $more; $tmp_post = $post; $tmp_more = $more; $args = array('numberposts' => $number, 'orderby' => 'post_date', 'order' => 'DESC'); if ($category_slug != '') { $category_array = explode(',', $category_slug); $args = array('numberposts' => $number, 'orderby' => 'post_date', 'order' => 'DESC', 'tax_query' => array(array('taxonomy' => 'category', 'field' => 'slug', 'terms' => $category_array, 'include_children' => false))); } if ($only_sticky == 'yes') { $sticky = get_option('sticky_posts'); $args['post__in'] = $sticky; $args['ignore_sticky_posts'] = false; } $posts = get_posts($args); $i = 0; $section_id = 'scrolling_posts_' . alaya_random_string(6, false); $post_slide = '<section id="' . $section_id . '" class="scrolling_posts flexslider">' . PHP_EOL; $post_slide .= '<header class="' . $header . '"> <h5 class="archive_title"><span>' . esc_attr($title) . '</span></h5>' . PHP_EOL; if ($number > 3 && count($posts) > 3) { $post_slide .= '<div class="controlNav"><a href="javascript:void(0);" id="prev_' . $section_id . '" class="prev"><i class="fa fa-chevron-left"></i></a> <a href="javascript:void(0);" class="next" id="next_' . $section_id . '"><i class="fa fa-chevron-right"></i></a></div>'; } $post_slide .= '</header>' . PHP_EOL; $post_slide .= '<ul class="slides columns' . $columns . '">' . PHP_EOL; if ($i != count($posts)) { $post_slide .= '<li>' . PHP_EOL; } foreach ($posts as $post) { setup_postdata($post); $image_id = get_post_thumbnail_id($post->ID); $thumbnail_url = wp_get_attachment_image_src($image_id, 'blog_thumbnail', true); $more = 0; $url = get_permalink($post->ID); $title = $post->post_title; $post_slide .= '<div class="blog-post post">'; if (has_post_thumbnail()) { $post_slide .= '<div class="thumbnail"><a href="' . $url . '" title="' . $title . '"><img src="' . $thumbnail_url[0] . '" class="featured_image" alt="' . $title . '" /></a></div>'; } $post_slide .= '<span>' . get_the_category_list(', ') . '</span>'; $post_slide .= '<h4><a href="' . $url . '" title="' . $title . '">' . $title . '</a></h4>'; $post_slide .= '<p>' . alaya_truncate(get_the_excerpt(), 150) . '</p>'; $post_slide .= '</div>' . PHP_EOL; $i++; if ($i % $columns == 0) { $post_slide .= '</li>' . PHP_EOL; if ($i != count($posts)) { $post_slide .= '<li>' . PHP_EOL; } } } $post_slide .= '</ul><div class="clearfix"></div>'; $post_slide .= '<div class="' . $section_id . '_alaya_loader alaya_loader" style="top:50%;left:47%;"><i class="fa fa-spinner fa-spin"></i></div>' . PHP_EOL; $post_slide .= '</section>'; $post_slide .= "<script type='text/javascript'>\r\n\t\tjQuery(document).ready(function(\$){\r\n\t\t\t/*Scrolling Posts*/\r\n\t\t\t\$(window).load(function(){\r\n\t\t\t\t\$('#" . $section_id . "').flexslider({\r\n\t\t\t\t slideshow:true,\r\n\t\t\t\t video: true,\r\n\t\t\t\t keyboard: true,\r\n\t\t\t\t animation: 'slide',\r\n\t\t\t\t directionNav: false, \r\n\t\t\t\t controlNav:false,\r\n\t\t\t\t smoothHeight:false,\r\n\t\t\t\t mousewheel: false, \r\n\t\t\t\t multipleKeyboard: true, \r\n\t\t\t\t animationLoop: false, \r\n\t\t\t\t pauseOnHover:true,\r\n\t\t\t\t slideshowSpeed: 20000,\r\n\t\t\t\t prevText:'',\r\n\t\t\t\t nextText:'',\r\n\t\t\t\t start:function(){\r\n\t\t\t\t\t \$('." . $section_id . "_alaya_loader').hide();\r\n\t\t\t\t\t \$('#" . $section_id . " .thumbnail').each(function(){\r\n\t\t\t\t\t\t var overlay_width,overlay_height,marginTop,marginLeft;\r\n\t\t\t\t\t var wrapper_width=\$(this).width();var wrapper_height=\$(this).height(); \r\n\t\t\t\t\t\t if(\$(this).children('img').height()<wrapper_height){\r\n\t\t\t\t\t\t \$(window).load(function(){\r\n\t\t\t\t\t\t\twrapper_height=\$(this).children('img').height();\r\n\t\t\t\t\t\t if(wrapper_height==0){\r\n\t\t\t\t\t\t\t wrapper_height=200;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\$(this).css('height',wrapper_height);\r\n\t\t\t\t\t\t })\t\t\t\t\t \r\n\t\t\t\t\t\t }\t \r\n\t\t\t\t\t\t if(\$(window).width()>800){\r\n\t\t\t\t\t overlay_width=wrapper_width-20;\r\n\t\t\t\t\t\t overlay_height=wrapper_height-20;\r\n\t\t\t\t\t\t }else{\r\n\t\t\t\t\t\t overlay_width=wrapper_width;\r\n\t\t\t\t\t\t overlay_height=wrapper_height;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t marginTop=overlay_height/2;\r\n\t\t\t\t\t\t marginLeft=overlay_width/2;\r\n\t\t\t\t\t \$(this).children('.overlay').css({\r\n\t\t\t\t\t\t width:overlay_width+'px',\r\n\t\t\t\t\t\t height:overlay_height+'px',\r\n\t\t\t\t\t\t marginTop:'-'+marginTop+'px',\r\n\t\t\t\t\t\t marginLeft:'-'+marginLeft+'px'\r\n\t\t\t\t\t });\r\n\t\t\t\t\t\t \$(this).children('.overlay').children('i').css({\r\n\t\t\t\t\t\t width:'20px',\r\n\t\t\t\t\t\t height:'20px',\r\n\t\t\t\t\t\t display:'block',\r\n\t\t\t\t\t\t left:'50%',\r\n\t\t\t\t\t\t top:'50%',\r\n\t\t\t\t\t\t position:'absolute',\r\n\t\t\t\t\t\t marginTop:'-10px',\r\n\t\t\t\t\t\t marginLeft:'-10px'\r\n\t\t\t\t\t });\r\n\t\t\t\t\t });\r\n\t\t\t\t }\r\n\t\t\t });\r\n\t\t\t });\r\n\t\t\t \$('#prev_" . $section_id . ", #next_" . $section_id . "').on('click', function(){\r\n\t\t\t var action = \$(this).attr('class');\r\n\t\t\t \$('#" . $section_id . "').flexslider(action);\r\n\t\t\t return false;\r\n\t\t });\r\n\t });\r\n\t </script>"; $post = $tmp_post; $more = $tmp_more; return $post_slide; }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $number = $instance['number']; $flickrID = $instance['flickrID']; $widgetID = alaya_random_string(6, false); echo $before_widget; echo $before_title; echo esc_attr($title); echo $after_title; ?> <?php //Custom HTML Layout ?> <div id="<?php echo esc_attr($widgetID); ?> " class="gallery_widget clearfix"></div><div class="clearfix"></div> <script type="text/javascript"> jQuery('#<?php echo esc_attr($widgetID); ?> ').jflickrfeed({ limit:<?php echo esc_attr($number); ?> , qstrings: { id: '<?php echo esc_attr($flickrID); ?> ' }, itemTemplate: '<a rel="colorbox" class="lightbox" href="{{image_b}}" title="{{title}}">' + '<img src="{{image}}" alt="{{title}}" />' + '</a>' }, function() { jQuery('#<?php echo esc_attr($widgetID); ?> a').colorbox(); }); </script> <?php //Custom HTML Layout End ?> <?php echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $number = $instance['number']; $thumbnail = $instance['thumbnail']; $widgetID = alaya_random_string(6, false); $category = alaya_cat_slug($instance['category']); echo $before_widget; echo $before_title; echo esc_attr($title); echo $after_title; echo alaya_post_list($number, $thumbnail, $category); echo $after_widget; }
function alaya_format_media($thumbnail = 'yes', $title = "yes", $thumbnail_size = 'large') { $post_media = vp_metabox('post_format_meta.embed_code'); $post_media = str_replace('&', '&', $post_media); $return_html = ''; if (has_post_format('video') && $post_media != '') { $return_html .= '<div class="thumbnail">' . $post_media . '</div>'; if (alaya_opt('format_icon') == 1) { $return_html .= '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } } elseif (has_post_format('audio') && $post_media != '') { $return_html .= '<div class="thumbnail">' . $post_media . '</div>'; if (alaya_opt('format_icon') == 1) { $return_html .= '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } } elseif (has_post_format('gallery')) { if ($images = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => 50, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image'))) { $slider_id = get_the_ID() . '-' . alaya_random_string(6, false); $return_html .= '<div id="slider-' . esc_html($slider_id) . '" class="flexslider post_slider no_height"><div id="loader-' . esc_html($slider_id) . '" class="alaya_loader"><i class="fa fa-spinner fa-spin"></i></div><ul class="slides">'; foreach ($images as $image) { $attachmenturl = wp_get_attachment_url($image->ID); $attachmentimage = wp_get_attachment_image($image->ID, 'large'); $return_html .= '<li><a href="' . esc_url($attachmenturl) . '" class="lightbox">' . $attachmentimage . '</a></li>'; } $return_html .= '</ul></div>'; if (alaya_opt('format_icon') == 1) { $return_html .= '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } $return_html .= '<script type="text/javascript"> jQuery(document).ready(function($){ $(window).load(function(){ $("#slider-' . esc_html($slider_id) . '").flexslider({ slideshow:true, video: true, keyboard: true, animation: "slide", controlNav:true, smoothHeight:false, multipleKeyboard: true, prevText:"", nextText:"", start: function(slider) { $.flexloader(slider); $("#slider-' . esc_html($slider_id) . '").removeClass("no_height"); }, after: function(slider) { $.flexloader(slider); } }); $("#loader-' . esc_html($slider_id) . '").fadeOut(); }); }); </script>'; } } else { if (has_post_thumbnail() && $thumbnail == 'yes') { $return_html .= '<div class="thumbnail"><a title="' . esc_html(get_the_title()) . '" href="' . esc_url(get_permalink()) . '">' . get_the_post_thumbnail(get_the_ID(), 'large', array('class' => 'featured_image', 'alt' => esc_html(get_the_title()))) . '</a></div>'; } } $return_html = apply_filters('alaya_format_media', $return_html); return $return_html; }
function alaya_button_function($atts, $content) { //extract short code attr extract(shortcode_atts(array('href' => '', 'align' => 'left', 'bg_color' => '#000', 'text_color' => '#fff', 'border_color' => 'none', 'size' => 'small', 'target' => '_self', 'text' => 'Button', 'color' => '', 'anchor' => 0, 'lightbox' => 0), $atts)); if (!empty($color)) { switch (strtolower($color)) { case 'black': $bg_color = '#000000'; $text_color = '#ffffff'; break; case 'grey': $bg_color = '#666666'; $text_color = '#ffffff'; break; case 'white': $bg_color = '#f5f5f5'; $text_color = '#444444'; break; case 'blue': $bg_color = '#004a80'; $text_color = '#ffffff'; break; case 'yellow': $bg_color = '#f9b601'; $text_color = '#ffffff'; break; case 'red': $bg_color = '#9e0b0f'; $text_color = '#ffffff'; break; case 'orange': $bg_color = '#fe7201'; $text_color = '#ffffff'; break; case 'green': $bg_color = '#7aad34'; $text_color = '#ffffff'; break; case 'pink': $bg_color = '#d2027d'; $text_color = '#ffffff'; break; case 'purple': $bg_color = '#582280'; $text_color = '#ffffff'; break; } } if (!empty($size)) { switch (strtolower($size)) { case 'small': $btn_size = 'alaya_small_btn'; break; case 'large': $btn_size = 'alaya_large_btn'; break; case 'large-x': $btn_size = 'alaya_largex_btn'; break; } } $center = ''; if ($align == 'center') { $align = 'none'; $center = 'margin:auto;'; } $class = ''; if ($anchor == 1) { $class = ' anchor'; } $lightbox_class = ''; if ($lightbox == 1) { $lightbox_class = ' lightbox'; } $str = '<a id="button-' . alaya_random_string(6, false) . '" href="' . $href . '" class="alaya_btn ' . $btn_size . $class . $lightbox_class . '" style="float:' . $align . ';' . $center . 'background:' . $bg_color . ';color:' . $text_color . ';border:2px solid ' . $border_color . '" target="' . $target . '">' . $text . '</a>'; return $str; }