function parsePost($dir, $filename) { $posts = array(); if (preg_match('/^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})-(.+)\\.php$/', $filename, $matches) === 1) { $posted = \Carbon\Carbon::create($matches[1], $matches[2], $matches[3], 12); $slug = $matches[4]; $title = getPostTitle($dir . $filename); if (strlen($title) > 0) { return new Post($title, $slug, $posted); } } return null; }
function themerex_wrapper_end() { if (is_product()) { showShareButtons(array('post_id' => get_the_ID(), 'post_link' => get_permalink(), 'post_title' => getPostTitle(), 'post_descr' => getPostDescription(), 'post_thumb' => wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())))); } ?> </div> </article> </div><!-- #content --> <?php get_sidebar(); ?> <?php }
function getResizedImageTag($post, $w = null, $h = null, $c = null, $u = true, $find_thumb = false, $itemprop = false) { static $mult = 0; if ($mult == 0) { $mult = min(2, max(1, get_theme_option("retina_ready"))); } if (is_object($post)) { $alt = getPostTitle($post->ID); } else { if ((int) $post > 0) { $alt = getPostTitle($post); } else { $alt = basename($post); } } $url = getResizedImageURL($post, $w ? $w * $mult : $w, $h ? $h * $mult : $h, $c, $u, $find_thumb); /* if ($url != '') { if (($url_dir = getUploadsDirFromURL($url)) !== false) $size = @getimagesize($url_dir); else $size = false; return '<img class="wp-post-image" ' . ($size!==false && isset($size[3]) ? $size[3] : '') . ' alt="' . $alt . '" src="' . $url . '">'; } else return ''; */ return $url != '' ? '<img class="wp-post-image"' . ($w ? ' width="' . $w . '"' : '') . ($h ? ' height="' . $h . '"' : '') . ' alt="' . $alt . '" src="' . $url . '"' . ($itemprop ? ' itemprop="image"' : '') . '>' : ''; }
$avg_users = marksToDisplay(get_post_meta($post_id, 'reviews_avg2', true)); } else { $avg_author = 0; $avg_users = 0; } ?> <div class="itemscope" itemscope itemtype="http://schema.org/<?php echo $avg_author > 0 || $avg_users > 0 ? 'Review' : 'Article'; ?> "> <article <?php post_class('theme_article post_format_' . $post_format); ?> > <?php $post_title = apply_filters('the_title', getPostTitle()); $post_content = get_the_content(null, get_custom_option('show_text_before_readmore') != 'yes'); // Substitute WP [gallery] shortcode if (get_custom_option('substitute_gallery') == 'yes') { $post_content = substituteGallery($post_content, $post_id, $thumb_size[$blog_style]['w'], $thumb_size[$blog_style]['h'], 'none', true); } // Catch output from the_content filters $post_content = apply_filters('the_content', $post_content); // Substitute <video> tags to <iframe> if (get_custom_option('substitute_video') == 'yes') { $post_content = substituteVideo($post_content, $thumb_size[$blog_style]['w'], $thumb_size[$blog_style]['h']); } // Substitute <audio> tags with src from soundcloud to <iframe> if (get_custom_option('substitute_audio') == 'yes') { $post_content = substituteAudio($post_content); }
function writeChatPost($post) { $title = getPostTitle($post); //$body = "<div class=\"tumblr-post-body\">" . $post->body . "</div>"; $body = "<div class=\"tumblr-post-body\">"; foreach ($post->dialogue as &$msg) { $body = $body . "<div class=\"tumblr-chat-line\"><span class=\"tumblr-chat-label\">" . $msg->label . "</span><span class=\"tumblr-chat-text\">" . $msg->phrase . "</span></div>"; } $body = $body . "</div>"; return $title . $body; }
function sc_slider($atts, $content = null) { global $mult; if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("id" => "", "engine" => "swiper", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "border" => "none", "controls" => "no", "pagination" => "no", "caption" => "no", "links" => "no", "align" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => "", "info" => "yes", "progressbar" => "", "date_before" => "", "date_after" => ""), $atts)); global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links, $trex_accent_color; $THEMEREX_sc_slider_engine = $engine; $THEMEREX_sc_slider_width = $width; $THEMEREX_sc_slider_height = $height; $THEMEREX_sc_slider_links = sc_param_is_on($links); $show_pagination = in_array($pagination, array('default', 'thumbs', 'icons')) ? true : false; $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . 'px;' : '') . ($right !== '' ? 'margin-right:' . $right . 'px;' : '') . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : ''); $output = ''; if ($pagination == 'thumbs' || $pagination == 'icons') { $output .= '<div class="slider_wrap">'; } $output .= ($border != 'none' ? '<div class="sc_border sc_border_' . $border . ($align != '' && $align != 'none' ? ' sc_align' . $align : '') . '">' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (!empty($width) && $width < 600 ? ' sc_slider_compact' : '') . ($pagination == 'default' ? ' sc_slider_pagination' : ' sc_slider_nopagination') . ' pagination_style_' . $pagination . (sc_param_is_on($progressbar) ? ' sc_slider_progress' : '') . ($border == 'none' && $align != '' && $align != 'none' ? ' sc_align' . $align : '') . ($engine == 'swiper' ? ' swiper-container' : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>'; if ($engine == 'revo') { if (revslider_exists() && !empty($alias)) { $output .= do_shortcode('[rev_slider ' . $alias . ']'); } else { $output = ''; } } else { if ($engine == 'royal') { if (royalslider_exists() && !empty($alias)) { $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]'); } else { $output = ''; } } else { if ($engine == 'swiper') { $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">'; $content = empty($ids) || empty($cat) ? do_shortcode($content) : ''; if ($content) { $output .= $content; } else { global $post; if (!empty($ids)) { $posts = explode(',', $ids); $count = count($posts); } $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc'); if ($offset > 0 && empty($ids)) { $args['offset'] = $offset; } $args = addSortOrderInQuery($args, $orderby, $order, true); $args = addPostsAndCatsInQuery($args, $ids, $cat); if (!empty($date_before)) { $args['date_query']['before'] = $date_before; } if (!empty($date_after)) { $args['date_query']['after'] = $date_after; } $query = new WP_Query($args); $pagination_posts = $show_pagination ? array() : ''; $i = 0; while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $post_link = get_permalink(); $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); $post_accent_color = ''; $post_category = ''; $post_category_link = ''; $post_title = getPostTitle($post_id); $post_title = '<span>' . str_replace(' ', '</span><span>', $post_title) . '</span>'; $post_obj = get_post($post_id); $post_content = $post_obj->post_content; $post_format = get_post_format($post_id); if ($post_format == 'video') { $post_video = getPostVideo($post_content); $post_video_frame = '<iframe class="video_frame"' . ' src="' . getVideoPlayerURL($post_video) . '"' . ' width="100%"' . (!empty($height) ? ' height=' . $height . 'px' : '') . ' frameborder="0" webkitAllowFullScreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen" allowFullScreen="allowFullScreen"></iframe>'; } $post_author_data = get_userdata($post_obj->post_author); $post_author = $post_author_data->user_nicename; $author_link = get_author_posts_url($post_obj->post_author); $post_date = '<i class="icon-clock-1"></i>' . date('M d, Y', strtotime($post_obj->post_date)); $post_comments = $post_obj->comment_count; $post_comments_link = '<a href="' . $post_link . '"><i class="icon-comment-1"></i>' . $post_comments . '</a>'; $post_info = '<div class="slide_info">' . __('By ', 'themerex') . '<a href="' . $author_link . '">' . $post_author . '</a><span class="separator">|</span>' . $post_date . '<span class="separator">|</span>' . $post_comments_link . '</div>'; $output .= '<li' . ($engine == 'swiper' ? ' class="swiper-slide' . ($post_format == 'video' ? ' format-video' : '') . '"' : '') . ' style="background-image:url(' . $post_attachment . ');' . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : '') . '"' . ($post_format == 'video' && !empty($post_video_frame) ? ' data-video="' . esc_attr($post_video_frame) . '"' : '') . ' >'; $output .= '<a href="' . $post_link . '" class="sc_slider_post_link"></a>'; $output .= '<div class="slider_info_wrap" ' . (!empty($height) ? 'style="height:' . $height . 'px"' : '') . '>'; if (!sc_param_is_off($caption)) { $post_hover_bg = get_custom_option('theme_color', null, $post_id); $post_bg = ''; $output .= '<div class="sc_slider_info' . ($caption == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '">'; $post_descr = getPostDescription(); $output .= '<h2 class="sc_slider_subtitle">' . $post_title . '</h2>'; $output .= $info == 'yes' ? $post_info : ''; $output .= '</div>'; } $output .= '</div>'; $output .= '</li>'; if ($show_pagination) { $post_format = get_post_format($post_id); $format_icon = getPostFormatIcon($post_format); $pagination_posts[$i] = '<li class="pagination_post swiper-slide' . ($i == 0 ? ' current' : '') . '">'; if ($pagination == 'thumbs') { $pagination_posts[$i] .= !empty($post_attachment) ? '<div class="post_thumb">' . getResizedImageTag($post_attachment, 50 * $mult, 50 * $mult) . '</div>' : ''; } else { $pagination_posts[$i] .= '<div class="post_icon"><i class="' . $format_icon . '"></i></div>'; $post_info = $post_date . '<span class="separator">|</span><i class="icon-comment-1"></i>' . $post_comments; } $pagination_posts[$i] .= '<div class="pagi_wrap">'; $pagination_posts[$i] .= '<h4>' . getPostTitle($post_id) . '</h4>'; $pagination_posts[$i] .= !empty($post_info) && $pagination != 'thumbs' ? '<div class="post_info">' . $post_info . '</div>' : ''; $pagination_posts[$i] .= '</div>'; $pagination_posts[$i] .= '</li>'; } $i++; } wp_reset_postdata(); } $output .= '</ul>'; if ($show_pagination) { if (!empty($pagination_posts)) { $pagination_output = ''; foreach ($pagination_posts as $pagi_post) { $pagination_output .= $pagi_post; } } } if (sc_param_is_on($controls)) { $output .= ' <ul class="flex-direction-nav"> <li><a class="flex-prev" href="#">' . (!empty($width) && $width < 600 ? '<span class="icon-left-open-big"></span>' : '') . '</a></li> <li><a class="flex-next" href="#">' . (!empty($width) && $width < 600 ? '<span class="icon-right-open-big"></span>' : '') . '</a></li> </ul>'; } } else { $output = ''; } } } $output .= !empty($output) ? ($border != 'none' ? '</div>' : '') . '</div>' : ''; $output .= '<div class="flex-control-nav"' . (!empty($pagination_output) ? ' style="height:' . $height . 'px"' : '') . '>' . (!empty($pagination_output) ? '<div class="swipe_scroll_vertical"></div><ul class="slides swiper-wrapper">' . $pagination_output . '</ul></div>' : '') . '</div>'; return $output; }
function sc_slider($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("id" => "", "engine" => "flex", "alias" => "", "ids" => "", "theme" => "dark", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "controls" => "no", "pagination" => "no", "titles" => "no", "links" => "no", "rev_style" => "rev_full", "align" => "", "width" => "100%", "height" => "400", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); /*scripts & styles*/ themerex_enqueue_style('swiperslider-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.css', array(), null); themerex_enqueue_script('swiperslider', get_template_directory_uri() . '/js/swiper/idangerous.swiper-2.1.js', array('jquery'), null, true); themerex_enqueue_style('swiperslider-scrollbar-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar.css', array(), null); themerex_enqueue_script('swiperslider-scrollbar', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar-2.1.js', array('jquery'), null, true); themerex_enqueue_script('hover-dir', get_template_directory_uri() . '/js/hover/jquery.hoverdir.js', array(), null, true); themerex_enqueue_style('hover-intent', get_template_directory_uri() . '/js/hover/hoverIntent.js', array(), null); global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links; $THEMEREX_sc_slider_engine = $engine; $THEMEREX_sc_slider_width = $width; $THEMEREX_sc_slider_height = $height; $THEMEREX_sc_slider_links = sc_param_is_on($links); $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . ((int) $left > 0 || (int) $left < 0 ? 'px' : '') . ';' : '') . ($right !== '' ? 'margin-right:' . $right . ((int) $right > 0 || (int) $right < 0 ? 'px' : '') . ';' : '') . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : ''); $c = ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : '') . (sc_param_is_on($pagination) ? ' sc_slider_pagination' : '') . ($align != '' && $align != 'none' ? ' sc_float_' . $align : '') . ($engine == 'swiper' ? ' swiper-container' : ''); $output = '<div' . ($id ? ' id="sc_slider_' . $id . '"' : '') . ' class="sc_slider ' . $c . '" ' . ($s != '' ? ' style="' . $s . '"' : '') . ' data-settings="horizontal">'; if ($engine == 'revo') { if (revslider_exists() && !empty($alias)) { $output .= do_shortcode('[rev_slider ' . $alias . ']'); } else { $output = ''; } } else { if ($engine == 'royal') { if (royalslider_exists() && !empty($alias)) { $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]'); } else { $output = ''; } } else { if ($engine == 'flex' || $engine == 'swiper') { $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">'; $content = do_shortcode($content); if ($content) { $output .= $content; } else { global $post; if (!empty($ids)) { $posts = explode(',', $ids); $count = count($posts); } $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc'); if ($offset > 0 && empty($ids)) { $args['offset'] = $offset; } $args = addSortOrderInQuery($args, $orderby, $order, true); $args = addPostsAndCatsInQuery($args, $ids, $cat); $query = new WP_Query($args); while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $post_link = get_permalink(); $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); $post_accent_color = ''; $post_category = ''; $post_category_link = ''; $post_title = getPostTitle($post_id); $avg_author = 0; $ed = themerex_substr($width, -1) == '%' ? '%' : 'px'; //image crop $no_crop = getThumbSizes(array('thumb_size' => 'image_large', 'thumb_crop' => true, 'sidebar' => false)); $crop = array("w" => $width != '' && $ed != '%' ? $width : $no_crop['w'], "h" => $height != '' && $ed != '%' ? $height : null); $post_attachment = getResizedImageURL($post_attachment, $crop['w'], $crop['h']); $output .= '<li' . ($engine == 'swiper' ? ' class="swiper-slide"' : '') . ' data-theme="' . ($theme != '' ? $theme : 'dark') . '" style="background-image:url(' . $post_attachment . ');' . (!empty($width) ? ' width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? ' height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : '') . '">' . (sc_param_is_on($links) ? '<a href="' . $post_attachment . '" title="' . htmlspecialchars($post_title) . '">' : ''); if (!sc_param_is_off($titles)) { $post_hover_bg = get_custom_option('theme_color', null, $post_id); $post_bg = ''; if ($post_hover_bg != '' && !is_inherit_option($post_hover_bg)) { $rgb = Hex2RGB_1($post_hover_bg); $post_hover_ie = str_replace('#', '', $post_hover_bg); $post_bg = "background-color: rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.8);"; } $output .= '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : ' sc_slider_info_slide') . ($engine == 'swiper' ? ' content-slide' : '') . '"><div class="main">'; $post_descr = getPostDescription(); //reviews if (get_custom_option('show_reviews') == 'yes' && get_custom_option('slider_reviews') == 'yes') { $output_reviews = ''; $rating_max = get_custom_option('reviews_max_level'); $review_title = sprintf($rating_max < 100 ? __('Rating: %s from %s', 'themerex') : __('Rating: %s', 'themerex'), number_format($avg_author, 1) . ($rating_max < 100 ? '' : '%'), $rating_max . ($rating_max < 100 ? '' : '%')); $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' && $orderby != 'users_rating' || $orderby == 'author_rating' ? '' : '2'), true)); if ($avg_author > 0 && get_custom_option('slider_reviews_style') == 'rev_short') { $output .= '<div class="sc_slider_reviews_short" title="' . $review_title . '"><span class="rInfo">' . $avg_author . '</span><span class="rDelta">' . ($rating_max < 100 ? '<span class="icon-star"></span>' : '%') . '</span></div>'; } else { if ($avg_author > 0 && get_custom_option('slider_reviews_style') == 'rev_full') { $output_reviews .= '<div class="sc_slider_reviews reviews_summary blog_reviews" title="' . $review_title . '">' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>'; } } $output .= $output_reviews; } //category if (get_custom_option("slider_info_category") == 'yes') { // || empty($cat)) { // Get all post's categories $post_categories = getCategoriesByPostId($post_id); $post_categories_str = ''; for ($i = 0; $i < count($post_categories); $i++) { if ($post_category == '') { if (get_theme_option('close_category') == 'parental') { $parent_cat_id = 0; //(int) get_custom_option('category_id'); $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id); if ($parent_cat) { $post_category = $parent_cat['name']; $post_category_link = $parent_cat['link']; if ($post_accent_color == '') { $post_accent_color = get_category_inherited_property($parent_cat['term_id'], 'theme_color'); } } } else { $post_category = $post_categories[$i]['name']; $post_category_link = $post_categories[$i]['link']; if ($post_accent_color == '') { $post_accent_color = get_category_inherited_property($post_categories[$i]['term_id'], 'theme_color'); } } } if ($post_category != '' && $post_accent_color != '') { break; } } if ($post_category == '' && count($post_categories) > 0) { $post_category = $post_categories[0]['name']; $post_category_link = $post_categories[0]['link']; if ($post_accent_color == '') { $post_accent_color = get_category_inherited_property($post_categories[0]['term_id'], 'theme_color'); } } if ($post_category != '') { $output .= '<div class="sc_slider_category"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '><a href="' . $post_category_link . '">' . $post_category . '</a></div>'; } } //title if (strlen($post_title) > 25) { $post_title = substr($post_title, 0, 25) . '...'; } $output .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>'; //descriptions if (get_custom_option('slider_descriptions') == 'yes') { $output .= '<div class="sc_slider_descr">' . $post_descr . '</div>'; } $output .= '</div></div>'; } $output .= (sc_param_is_on($links) ? '</a>' : '') . '</li>'; } wp_reset_postdata(); } $output .= '</ul>'; if ($engine == 'swiper') { if (sc_param_is_on($controls)) { $output .= ' <ul class="slider-control-nav"> <li class="slide-prev"><a class="icon-left-open-big" href="#"></a></li> <li class="slide-next"><a class="icon-right-open-big" href="#"></a></li> </ul>'; } if (sc_param_is_on($pagination)) { $output .= ' <div class="slider-pagination-nav"></div> '; } } } else { $output = ''; } } } $output .= !empty($output) ? '</div>' : ''; return $output; }
} $post_link = get_permalink(); $post_comments_link = $counters == 'comments' ? get_comments_link($post_id) : $post_link; $post_date = getDateOrDifference(get_the_date('Y-m-d H:i:s')); $post_comments = get_comments_number(); $post_views = getPostViews($post_id); $post_icon = getPostFormatIcon($post_format); $post_author = get_the_author(); $post_author_id = get_the_author_meta('ID'); $post_author_url = get_author_posts_url($post_author_id, ''); $post_thumb = getResizedImageTag($post_id, $thumb_size[$blog_style]['w'], $thumb_size[$blog_style]['h']); $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); // Get post title, content, excerpt and description if (get_theme_option('preserve_decoration') == 'no') { // -------------- Old way to get title, excerpt and content ----------------------- $post_title = getPostTitle(); $post_excerpt = trim(chop($post->post_excerpt)); //getPostDescription(); $post_descr = in_array($post_format, array('quote', 'link')) ? get_the_content('') : getPostDescription(); //get_the_excerpt(); $post_content = get_the_content('<span class="readmore">' . __('Read more', 'themerex') . '</span>'); $post_content_full = $post->post_content; //get_the_content() not used, because it trim content up to <!-- more --> in each case! $post_content_prepared = do_shortcode($post_content_full); } else { // ----------------- New way to get title, excerpt and content ----------------------- $post_title = get_the_title(); global $more; $old_more = $more; $more = -1; $post_content_full = get_the_content();
function sc_slider($atts, $content = null) { extract(shortcode_atts(array("id" => "", "engine" => "flex", "links" => "0", "controls" => "0", "titles" => "0", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "width" => "", "height" => "", "align" => "", "border" => "0", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . 'px;' : '') . ($right !== '' ? 'margin-right:' . $right . 'px;' : '') . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : ''); $output = '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . ' sc_slider_' . $engine . ($controls > 0 ? ' sc_slider_controls' : '') . ($align != '' ? ' align' . $align : '') . ($border > 0 ? ' sc_slider_border' : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>'; if ($engine == 'revo') { if (is_plugin_active('revslider/revslider.php') && !empty($alias)) { $output .= do_shortcode('[rev_slider ' . $alias . ']'); } else { $output = ''; } } else { if ($engine == 'flex') { $output .= '<ul class="slides">'; global $post; if (!empty($ids)) { $posts = explode(',', $ids); $count = count($posts); } $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc'); if ($offset > 0 && empty($ids)) { $args['offset'] = $offset; } $args = addSortOrderInQuery($args, $orderby, $order, true); $args = addPostsAndCatsInQuery($args, $ids, $cat); $query = new WP_Query($args); while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $post_link = get_permalink(); $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); $post_accent_color = ''; $post_accent_category = ''; $post_title = getPostTitle($post_id); $output .= '<li style="background-image:url(' . $post_attachment . ')">' . ($links > 0 ? '<a href="' . $post_attachment . '" title="' . htmlspecialchars($post_title) . '">' : ''); if ($titles) { $post_hover_bg = get_custom_option('puzzles_post_bg', null, $post_id); $post_bg = ''; if ($post_hover_bg != '' && $post_hover_bg != 'default') { $rgb = Hex2RGB($post_hover_bg); $post_hover_ie = str_replace('#', '', $post_hover_bg); $post_bg = "background-color: rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.8);"; } $output .= '<div class="sc_slider_info' . ($titles > 1 ? ' sc_slider_info_fixed' : '') . ' theme_accent_bg"' . ($post_bg != '' ? ' style="' . $post_bg . '"' : '') . '>'; $post_descr = getPostDescription(); if (get_custom_option("slider_info_category") == 'yes') { // || empty($cat)) { // Get all post's categories $post_categories = getCategoriesByPostId($post_id); $post_categories_str = ''; for ($i = 0; $i < count($post_categories); $i++) { if ($post_accent_category == '') { if (get_theme_option('close_category') == 'parental') { $parent_cat_id = 0; //(int) get_custom_option('category_id'); $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id); if ($parent_cat) { $post_accent_category = $parent_cat['name']; if ($post_accent_color == '') { $post_accent_color = getCategoryInheritedProperty($parent_cat['term_id'], 'theme_accent_color'); } } } else { $post_accent_category = $post_categories[$i]['name']; if ($post_accent_color == '') { $post_accent_color = getCategoryInheritedProperty($post_categories[$i]['term_id'], 'theme_accent_color'); } } } if ($post_accent_category != '' && $post_accent_color != '') { break; } } if ($post_accent_category == '' && count($post_categories) > 0) { $post_accent_category = $post_categories[0]['name']; if ($post_accent_color == '') { $post_accent_color = getCategoryInheritedProperty($post_categories[0]['term_id'], 'theme_accent_color'); } } if ($post_accent_category != '') { $output .= '<div class="sc_slider_category theme_accent_bg"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '>' . $post_accent_category . '</div>'; } } $output_reviews = ''; if (get_custom_option('show_reviews') == 'yes' && get_custom_option('slider_reviews') == 'yes') { $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' && $orderby != 'users_rating' || $orderby == 'author_rating' ? '' : '2'), true)); if ($avg_author > 0) { $output_reviews .= '<div class="sc_slider_reviews reviews_summary blog_reviews' . (get_custom_option("slider_info_category") == 'yes' ? ' after_category' : '') . '">' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>'; } } if (get_custom_option("slider_info_category") == 'yes') { $output .= $output_reviews; } $output .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>'; if (get_custom_option("slider_info_category") != 'yes') { $output .= $output_reviews; } if (get_custom_option('slider_descriptions') == 'yes') { $output .= '<div class="sc_slider_descr">' . $post_descr . '</div>'; } $output .= '</div>'; } else { //$output .= '<a href="'. $post_link . '">'.$titles.'</a>'; } $output .= ($links > 0 ? '</a>' : '') . '</li>'; } wp_reset_postdata(); $output .= '</ul>'; } else { $output = ''; } } $output .= !empty($output) ? '</div>' : ''; return $output; }
function getResizedImageTag($post, $w = null, $h = null, $c = null, $u = true, $find_thumb = false, $itemprop = false) { static $mult = 0; if ($mult == 0) { $mult = min(2, max(1, get_theme_option("retina_ready"))); } if (is_object($post)) { $alt = getPostTitle($post->ID); } else { if ((int) $post > 0) { $alt = getPostTitle($post); } else { $alt = basename($post); } } $url = getResizedImageURL($post, $w ? $w * $mult : $w, $h ? $h * $mult : $h, $c, $u, $find_thumb); return $url != '' ? '<img class="wp-post-image"' . ($w ? ' width="' . $w . '"' : '') . ($h ? ' height="' . $h . '"' : '') . ' alt="' . $alt . '" src="' . $url . '"' . ($itemprop ? ' itemprop="image"' : '') . '>' : ''; }