function axiom_get_custom_option($name, $defa = null, $post_id = 0, $post_type = 'post', $tax_id = 0, $tax_type = 'category') { if (isset($_GET[$name])) { $rez = $_GET[$name]; } else { global $AXIOM_GLOBALS; $hash_name = $name . '_' . $tax_id . '_' . $post_id; if (!empty($AXIOM_GLOBALS['theme_options_loaded']) && isset($AXIOM_GLOBALS['custom_options'][$hash_name])) { $rez = $AXIOM_GLOBALS['custom_options'][$hash_name]; } else { if ($tax_id > 0) { $rez = axiom_taxonomy_get_inherited_property($tax_type, $tax_id, $name); if ($rez == '') { $rez = axiom_get_theme_option($name, $defa); } } else { if ($post_id > 0) { $rez = axiom_get_theme_option($name, $defa); $custom_options = get_post_meta($post_id, 'post_custom_options', true); if (isset($custom_options[$name]) && !axiom_is_inherit_option($custom_options[$name])) { $rez = $custom_options[$name]; } else { $terms = array(); $tax = axiom_get_taxonomy_categories_by_post_type($post_type); $tax_obj = get_taxonomy($tax); $tax_query = !empty($tax_obj->query_var) ? $tax_obj->query_var : $tax; if ($tax == 'category' && is_category() || $tax == 'post_tag' && is_tag() || is_tax($tax)) { // Current page is taxonomy's archive (Categories and Tags need specific check) $terms = array(get_queried_object()); } else { $taxes = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'taxonomy' => $tax)); if (!empty($taxes[$tax]->terms)) { $terms = $taxes[$tax]->terms; } } $tmp = ''; if (!empty($terms)) { for ($cc = 0; $cc < count($terms) && (empty($tmp) || axiom_is_inherit_option($tmp)); $cc++) { $tmp = axiom_taxonomy_get_inherited_property($terms[$cc]->taxonomy, $terms[$cc]->term_id, $name); } } if ($tmp != '') { $rez = $tmp; } } } else { $rez = axiom_get_theme_option($name, $defa); if (axiom_get_theme_option('show_theme_customizer') == 'yes' && axiom_get_theme_option('remember_visitors_settings') == 'yes' && function_exists('axiom_get_value_gpc')) { $tmp = axiom_get_value_gpc($name, $rez); if (!axiom_is_inherit_option($tmp)) { $rez = $tmp; } } if (isset($AXIOM_GLOBALS['template_options'][$name]) && !axiom_is_inherit_option($AXIOM_GLOBALS['template_options'][$name])) { $rez = is_array($AXIOM_GLOBALS['template_options'][$name]) ? $AXIOM_GLOBALS['template_options'][$name][0] : $AXIOM_GLOBALS['template_options'][$name]; } if (isset($AXIOM_GLOBALS['taxonomy_options'][$name]) && !axiom_is_inherit_option($AXIOM_GLOBALS['taxonomy_options'][$name])) { $rez = $AXIOM_GLOBALS['taxonomy_options'][$name]; } if (isset($AXIOM_GLOBALS['post_options'][$name]) && !axiom_is_inherit_option($AXIOM_GLOBALS['post_options'][$name])) { $rez = is_array($AXIOM_GLOBALS['post_options'][$name]) ? $AXIOM_GLOBALS['post_options'][$name][0] : $AXIOM_GLOBALS['post_options'][$name]; } } } $rez = apply_filters('axiom_filter_get_custom_option', $rez, $name); if (!empty($AXIOM_GLOBALS['theme_options_loaded'])) { $AXIOM_GLOBALS['custom_options'][$hash_name] = $rez; } } } return $rez; }
function axiom_sc_slider($atts, $content = null) { if (axiom_sc_in_shortcode_blogger()) { return ''; } extract(axiom_sc_html_decode(shortcode_atts(array("engine" => axiom_get_custom_option('substitute_slider_engine'), "custom" => "no", "alias" => "", "post_type" => "post", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "controls" => "no", "pagination" => "no", "titles" => "no", "descriptions" => axiom_get_custom_option('slider_info_descriptions'), "links" => "no", "align" => "", "interval" => "", "date_format" => "", "crop" => "yes", "autoheight" => "no", "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts))); if (empty($width) && $pagination != 'full') { $width = "100%"; } if (empty($height) && ($pagination == 'full' || $pagination == 'over')) { $height = 250; } if (!empty($height) && axiom_sc_param_is_on($autoheight)) { $autoheight = "off"; } if (empty($interval)) { $interval = mt_rand(5000, 10000); } global $AXIOM_GLOBALS; $AXIOM_GLOBALS['sc_slider_engine'] = $engine; $AXIOM_GLOBALS['sc_slider_width'] = axiom_prepare_css_value($width); $AXIOM_GLOBALS['sc_slider_height'] = axiom_prepare_css_value($height); $AXIOM_GLOBALS['sc_slider_links'] = axiom_sc_param_is_on($links); $AXIOM_GLOBALS['sc_slider_bg_image'] = false; $AXIOM_GLOBALS['sc_slider_crop_image'] = $crop; if (empty($id)) { $id = "sc_slider_" . str_replace('.', '', mt_rand()); } $ms = axiom_get_css_position_from_values($top, $right, $bottom, $left); $ws = axiom_get_css_position_from_values('', '', '', '', $width); $hs = axiom_get_css_position_from_values('', '', '', '', '', $height); $css .= (!in_array($pagination, array('full', 'over')) ? $ms : '') . $hs . $ws; if ($engine != 'swiper' && in_array($pagination, array('full', 'over'))) { $pagination = 'yes'; } $output = (in_array($pagination, array('full', 'over')) ? '<div class="sc_slider_pagination_area sc_slider_pagination_' . esc_attr($pagination) . ($align != '' && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (!axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . ($ms . $hs ? ' style="' . esc_attr($ms . $hs) . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="sc_slider sc_slider_' . esc_attr($engine) . ($engine == 'swiper' ? ' swiper-slider-container' : '') . (!empty($class) ? ' ' . esc_attr($class) : '') . (axiom_sc_param_is_on($autoheight) ? ' sc_slider_height_auto' : '') . ($hs ? ' sc_slider_height_fixed' : '') . (axiom_sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (axiom_sc_param_is_on($pagination) ? ' sc_slider_pagination' : ' sc_slider_nopagination') . (!in_array($pagination, array('full', 'over')) && $align != '' && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (!in_array($pagination, array('full', 'over')) && !axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . (!empty($width) && axiom_strpos($width, '%') === false ? ' data-old-width="' . esc_attr($width) . '"' : '') . (!empty($height) && axiom_strpos($height, '%') === false ? ' data-old-height="' . esc_attr($height) . '"' : '') . ((int) $interval > 0 ? ' data-interval="' . esc_attr($interval) . '"' : '') . ($css != '' ? ' style="' . esc_attr($css) . '"' : '') . '>'; axiom_enqueue_slider($engine); if ($engine == 'revo') { if (axiom_exists_revslider() && !empty($alias)) { $output .= do_shortcode('[rev_slider ' . esc_attr($alias) . ']'); } else { $output = ''; } } else { if ($engine == 'swiper') { $caption = ''; $output .= '<div class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '"' . ($engine == 'swiper' && $AXIOM_GLOBALS['sc_slider_bg_image'] ? ' style="' . esc_attr($hs) . '"' : '') . '>'; $content = do_shortcode($content); if (axiom_sc_param_is_on($custom) && $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 = axiom_query_add_sort_order($args, $orderby, $order); $args = axiom_query_add_filters($args, 'thumbs'); $args = axiom_query_add_posts_and_cats($args, $ids, $post_type, $cat); $query = new WP_Query($args); $post_number = 0; $pagination_items = ''; $show_image = 1; $show_types = 0; $show_date = 1; $show_author = 0; $show_links = 0; $show_counters = 'views'; //comments | rating while ($query->have_posts()) { $query->the_post(); $post_number++; $post_id = get_the_ID(); $post_type = get_post_type(); $post_title = get_the_title(); $post_link = get_permalink(); $post_link2 = $post_link; $post_date = get_the_date(!empty($date_format) ? $date_format : 'd.m.y'); $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); if (axiom_sc_param_is_on($crop)) { $post_attachment = $AXIOM_GLOBALS['sc_slider_bg_image'] ? axiom_get_resized_image_url($post_attachment, !empty($width) && (double) $width . ' ' == $width . ' ' ? $width : null, !empty($height) && (double) $height . ' ' == $height . ' ' ? $height : null) : axiom_get_resized_image_tag($post_attachment, !empty($width) && (double) $width . ' ' == $width . ' ' ? $width : null, !empty($height) && (double) $height . ' ' == $height . ' ' ? $height : null); } else { if (!$AXIOM_GLOBALS['sc_slider_bg_image']) { $post_attachment = '<img src="' . esc_url($post_attachment) . '" alt="">'; } } $post_accent_color = ''; $post_category = ''; $post_category_link = ''; if (in_array($pagination, array('full', 'over'))) { $old_output = $output; $output = ''; require axiom_get_file_dir('templates/parts/widgets-posts.php'); $pagination_items .= $output; $output = $old_output; } $output .= '<div' . ' class="' . esc_attr($engine) . '-slide"' . ' data-style="' . esc_attr($ws . $hs) . '"' . ' style="' . ($AXIOM_GLOBALS['sc_slider_bg_image'] ? 'background-image:url(' . esc_url($post_attachment) . ');' : '') . $ws . $hs . '"' . '>' . (axiom_sc_param_is_on($links) ? '<a href="' . esc_url($post_link2) . '" title="' . esc_attr($post_title) . '">' : '') . (!$AXIOM_GLOBALS['sc_slider_bg_image'] ? $post_attachment : ''); $caption = $engine == 'swiper' ? '' : $caption; if (!axiom_sc_param_is_off($titles)) { $post_hover_bg = axiom_get_custom_option('link_color', null, $post_id); $post_bg = ''; if ($post_hover_bg != '' && !axiom_is_inherit_option($post_hover_bg)) { $rgb = axiom_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);"; } $caption .= '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '"' . ($post_bg != '' ? ' style="' . esc_attr($post_bg) . '"' : '') . '>'; $post_descr = axiom_get_post_excerpt(); if (axiom_get_custom_option("slider_info_category") == 'yes') { // || empty($cat)) { // Get all post's categories $post_tax = axiom_get_taxonomy_categories_by_post_type($post_type); if (!empty($post_tax)) { $post_terms = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'taxonomy' => $post_tax)); if (!empty($post_terms[$post_tax])) { if (!empty($post_terms[$post_tax]->closest_parent)) { $post_category = $post_terms[$post_tax]->closest_parent->name; $post_category_link = $post_terms[$post_tax]->closest_parent->link; //$post_accent_color = axiom_taxonomy_get_inherited_property($post_tax, $post_terms[$post_tax]->closest_parent->term_id, 'link_color'); } /* if ($post_accent_color == '' && !empty($post_terms[$post_tax]->terms)) { for ($i = 0; $i < count($post_terms[$post_tax]->terms); $i++) { $post_accent_color = axiom_taxonomy_get_inherited_property($post_tax, $post_terms[$post_tax]->terms[$i]->term_id, 'link_color'); if ($post_accent_color != '') break; } } */ if ($post_category != '') { $caption .= '<div class="sc_slider_category"' . (axiom_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . esc_attr($post_accent_color) . '"' : '') . '><a href="' . esc_url($post_category_link) . '">' . $post_category . '</a></div>'; } } } } $output_reviews = ''; if (axiom_get_custom_option('show_reviews') == 'yes' && axiom_get_custom_option('slider_info_reviews') == 'yes') { $avg_author = axiom_reviews_marks_to_display(get_post_meta($post_id, 'reviews_avg' . (axiom_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 post_rating reviews_summary blog_reviews' . (axiom_get_custom_option("slider_info_category") == 'yes' ? ' after_category' : '') . '">' . '<div class="criteria_summary criteria_row">' . trim(axiom_reviews_get_summary_stars($avg_author, false, false, 5)) . '</div>' . '</div>'; } } if (axiom_get_custom_option("slider_info_category") == 'yes') { $caption .= $output_reviews; } $caption .= '<h3 class="sc_slider_subtitle"><a href="' . esc_url($post_link2) . '">' . $post_title . '</a></h3>'; if (axiom_get_custom_option("slider_info_category") != 'yes') { $caption .= $output_reviews; } if ($descriptions > 0) { $caption .= '<div class="sc_slider_descr">' . trim(axiom_strshort($post_descr, $descriptions)) . '</div>'; } $caption .= '</div>'; } $output .= ($engine == 'swiper' ? $caption : '') . (axiom_sc_param_is_on($links) ? '</a>' : '') . '</div>'; } wp_reset_postdata(); } $output .= '</div>'; if ($engine == 'swiper') { if (axiom_sc_param_is_on($controls)) { $output .= '<div class="sc_slider_controls_wrap"><a class="sc_slider_prev" href="#"></a><a class="sc_slider_next" href="#"></a></div>'; } if (axiom_sc_param_is_on($pagination)) { $output .= '<div class="sc_slider_pagination_wrap"></div>'; } } } else { $output = ''; } } if (!empty($output)) { $output .= '</div>'; if (!isset($pagination_items)) { $pagination_items = ''; } if ($pagination_items) { $output .= ' <div class="sc_slider_pagination widget_area"' . ($hs ? ' style="' . esc_attr($hs) . '"' : '') . '> <div id="' . esc_attr($id) . '_scroll" class="sc_scroll sc_scroll_vertical swiper-slider-container scroll-container"' . ($hs ? ' style="' . esc_attr($hs) . '"' : '') . '> <div class="sc_scroll_wrapper swiper-wrapper"> <div class="sc_scroll_slide swiper-slide"> ' . $pagination_items . ' </div> </div> <div id="' . esc_attr($id) . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_vertical"></div> </div> </div>'; $output .= '</div>'; } } return apply_filters('axiom_shortcode_output', $output, 'trx_slider', $atts, $content); }
function axiom_get_post_data(&$opt, $post_obj = null) { $opt = axiom_get_post_data_options($opt); global $post, $wp_query; $old_post = null; if (!empty($post) && is_object($post)) { $old_post = clone $post; } if ($post_obj != null) { $post = $post_obj; setup_postdata($post); } $cur_post = clone $post; $post_id = get_the_ID(); $post_parent_id = wp_get_post_parent_id($post_id); if (!$post_parent_id) { $post_parent_id = 0; } $post_type = get_post_type(); $post_protected = post_password_required(); $post_format = get_post_format(); if (empty($post_format)) { $post_format = 'standard'; } $post_icon = axiom_get_custom_option('icon', axiom_get_post_format_icon($post_format), $post_id, $post_type); //!!!!! Get option from specified post $post_flags = array('sticky' => is_sticky()); $post_link = get_permalink(); $post_comments_link = get_comments_link(); $post_date_sql = get_the_date('Y-m-d H:i:s'); $post_date_stamp = get_the_date('U'); $post_date = axiom_get_date_or_difference($post_date_sql); if (!empty($opt['date_format'])) { $parts = explode('+', $opt['date_format']); $post_date_part1 = empty($parts[0]) ? '' : date($parts[0], $post_date_stamp); $post_date_part2 = empty($parts[1]) ? '' : date($parts[1], $post_date_stamp); if ($post_date_part1 . $post_date_part2 != '') { $post_date = $post_date_part1 . ($post_date_part2 != '' ? ' ' . $post_date_part2 : ''); } } $post_comments = $post_views = $post_likes = 0; if ($opt['counters'] != '') { $post_comments = get_comments_number(); $post_views = axiom_get_post_views($post_id); $post_likes = axiom_get_post_likes($post_id); } $post_reviews_author = $post_reviews_users = 0; if ($opt['reviews']) { $post_reviews_author = axiom_reviews_marks_to_display(get_post_meta($post_id, 'reviews_avg', true)); $post_reviews_users = axiom_reviews_marks_to_display(get_post_meta($post_id, 'reviews_avg2', true)); } $post_author = get_the_author(); $post_author_id = get_the_author_meta('ID'); $post_author_url = get_author_posts_url($post_author_id, ''); // Is user can edit and/or delete this post? $allow_editor = axiom_get_theme_option("allow_editor") == 'yes'; $post_edit_enable = $allow_editor && ($post_type == 'post' && current_user_can('edit_posts', $post_id) || $post_type == 'page' && current_user_can('edit_pages', $post_id)); $post_delete_enable = $allow_editor && ($post_type == 'post' && current_user_can('delete_posts', $post_id) || $post_type == 'page' && current_user_can('delete_pages', $post_id)); // Post content global $more; $old_more = $more; $more = -1; $post_content_original = trim(chop($post->post_content)); $post_content_plain = trim(chop(get_the_content())); $more = $old_more; $post_content = trim(chop(get_the_content($opt['more_tag'], $opt['strip_teaser']))); // Substitute WP [gallery] shortcode $thumb_sizes = axiom_get_thumb_sizes(array('layout' => $opt['layout'])); if ($opt['content']) { if ($opt['substitute_gallery']) { $post_content = axiom_substitute_gallery($post_content, $post_id, $thumb_sizes['w'], $thumb_sizes['h_crop'], 'none', true); } $post_content = apply_filters('the_content', $post_content); if ($post_id != get_the_ID()) { // Fix bug in the WPML $post = $cur_post; setup_postdata($post); } if ($opt['substitute_video']) { $post_content = axiom_substitute_video($post_content, $thumb_sizes['w'], $thumb_sizes['h_crop']); } if ($opt['substitute_audio']) { $post_content = axiom_substitute_audio($post_content); } } // Post excerpt $post_excerpt_original = $post->post_excerpt; $post_excerpt = has_excerpt() || $post_protected ? get_the_excerpt() : ''; if (empty($post_excerpt)) { if (($more_pos = axiom_strpos($post_content_plain, '<span id="more-')) !== false) { $post_excerpt = axiom_substr($post_content_plain, 0, $more_pos); } else { $post_excerpt = in_array($post_format, array('quote', 'link')) ? $post_content : strip_shortcodes(strip_tags(get_the_excerpt())); } } if ($opt['substitute_gallery']) { $post_excerpt = axiom_substitute_gallery($post_excerpt, $post_id, $thumb_sizes['w'], $thumb_sizes['h_crop']); } $post_excerpt = apply_filters('axiom_filter_sc_clear_around', $post_excerpt); $post_excerpt = apply_filters('the_excerpt', $post_excerpt); $post_excerpt = apply_filters('axiom_filter_p_clear_around', $post_excerpt); if ($post_id != get_the_ID()) { // Fix bug in the WPML $post = $cur_post; setup_postdata($post); } if ($opt['substitute_video']) { $post_excerpt = axiom_substitute_video($post_excerpt, $thumb_sizes['w'], $thumb_sizes['h_crop']); } if ($opt['substitute_audio']) { $post_excerpt = axiom_substitute_audio($post_excerpt); } $post_excerpt = trim(chop(str_replace(array('[...]', '[…]'), array('', ''), $post_excerpt))); // Post Title $post_title = $post_title_plain = trim(chop(get_the_title())); $post_title = apply_filters('the_title', $post_title); if ($post_id != get_the_ID()) { // Fix bug in the WPML $post = $cur_post; setup_postdata($post); } // Prepare dedicated content $opt['dedicated'] = axiom_sc_get_dedicated_content(); $opt['location'] = !empty($opt['location']) ? $opt['location'] : axiom_get_custom_option('dedicated_location'); if (empty($opt['location']) || $opt['location'] == 'default') { $opt['location'] = axiom_get_custom_option('dedicated_location', '', $post_id, $post_type); } //!!!!! Get option from specified post if ($opt['location'] == 'alter' && !is_single() && (!is_page() || isset($wp_query->is_posts_page) && $wp_query->is_posts_page == 1)) { $loc = array('center', 'right', 'left'); $opt['location'] = $loc[($opt['number'] - 1) % count($loc)]; } if (!empty($opt['dedicated'])) { $class = axiom_get_tag_attrib($opt['dedicated'], '<div class="sc_section>', 'class'); if ($opt['location'] == 'default') { if (($pos = axiom_strpos($class, 'sc_align')) !== false) { $pos += 8; $pos2 = axiom_strpos($class, ' ', $pos); $opt['location'] = $pos2 === false ? axiom_substr($class, $pos) : axiom_substr($class, $pos, $pos2 - $pos); } if ($opt['location'] == '' || $opt['location'] == 'default') { $opt['location'] = 'center'; } } if (!is_singular() || axiom_get_global('blog_streampage') || axiom_sc_in_shortcode_blogger(true) || axiom_strpos($class, 'sc_align') !== false && axiom_strpos($class, 'columns') === false) { $class = str_replace(array('sc_alignright', 'sc_alignleft', 'sc_aligncenter'), array('', '', ''), $class) . ' sc_align' . esc_attr($opt['location']); //if ($opt['location'] == 'center' && axiom_strpos($class, 'column-2_3')===false && $opt['sidebar']) // $class = str_replace('columns', '_columns', $class) . ' column-2_3'; //else if (($opt['location'] == 'left' || $opt['location'] == 'right') && axiom_strpos($class, 'column-1_2')===false)// && $opt['sidebar']) // $class = str_replace('columns', '_columns', $class) . ' column-1_2'; $opt['dedicated'] = axiom_set_tag_attrib($opt['dedicated'], '<div class="sc_section>', 'class', $class); } } //else if ($opt['location']=='' || $opt['location']=='default') //$opt['location'] = 'center'; //if ($opt['location']=='default') $opt['location']='center'; $opt['post_class'] = $opt['location']; // Substitute <video> tags to <iframe> in dedicated content if ($opt['substitute_video']) { $opt['dedicated'] = axiom_substitute_video($opt['dedicated'], $thumb_sizes['w'], $thumb_sizes['h_crop']); } // Substitute <audio> tags with src from soundcloud to <iframe> if ($opt['substitute_audio']) { $opt['dedicated'] = axiom_substitute_audio($opt['dedicated']); } // Extract gallery, video and audio from full post content $post_thumb = $post_thumb_url = $post_attachment = $post_gallery = $post_video = $post_video_image = $post_audio = $post_audio_image = $post_url = $post_url_target = ''; $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); if (axiom_substr($opt['layout'], 0, 6) == 'single') { $post_thumb = axiom_get_resized_image_tag($post_id, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true); } else { if (axiom_substr($opt['layout'], 0, 10) == 'attachment') { $post_thumb = axiom_get_resized_image_tag($post_attachment, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true); } else { $post_thumb = axiom_get_resized_image_tag($post_id, $thumb_sizes['w'], $post_type == 'product' && axiom_get_theme_option('crop_product_thumb') == 'no' ? null : $thumb_sizes['h']); } } $post_thumb_url = axiom_get_tag_attrib($post_thumb, '<img>', 'src'); if ($post_format == 'gallery') { $post_gallery = axiom_build_gallery_tag(axiom_get_post_gallery($post_content_plain, $post_id, max(2, axiom_get_custom_option('gallery_max_slides'))), $thumb_sizes['w'], $thumb_sizes['h_crop'], false, $post_link); } else { if ($post_format == 'video') { $src = ''; $post_video = axiom_get_post_video($post_content_original, false); if ($post_video == '') { $src = axiom_get_post_video($post_content_original, true); if (!axiom_is_youtube_url($src) && !axiom_is_vimeo_url($src)) { $src = ''; } } else { if (axiom_substr($post_video, 0, 1) == '[') { $src = axiom_get_tag_attrib($post_video, '[trx_video]', 'src'); if (empty($src)) { $src = axiom_get_tag_attrib($post_video, '[trx_video]', 'url'); } if (empty($src)) { $src = axiom_get_post_video($post_video, true); } $post_video_image = axiom_get_tag_attrib($post_video, '[trx_video]', 'image'); if ($post_video_image > 0) { $attach = wp_get_attachment_image_src($post_video_image, 'full'); if (isset($attach[0]) && $attach[0] != '') { $post_video_image = $attach[0]; } } if (empty($post_video_image)) { $post_video_image = axiom_get_video_cover_image($src); } if (empty($post_video_image)) { $post_video_image = $post_thumb; } $post_video_image = axiom_get_resized_image_tag($post_video_image, $thumb_sizes['w'], $thumb_sizes['h']); } else { $src = axiom_get_post_video($post_video, true); } } if ($src) { $src = axiom_get_video_player_url($src, $post_thumb != '' || $post_video_image != ''); $post_video = '<video src="' . esc_url($src) . '" width="' . esc_attr($thumb_sizes['w']) . '" height="' . round($thumb_sizes['w'] / 16 * 9) . '"></video>'; } if ($post_video != '' && $opt['substitute_video']) { $post_video = axiom_substitute_video($post_video, $thumb_sizes['w'], round($thumb_sizes['w'] / 16 * 9), false); //$thumb_sizes['h_crop']); } } else { if ($post_format == 'audio') { $src = $data = ''; $post_audio = axiom_get_post_audio($post_content_original, false); if ($post_audio == '') { $src = axiom_get_post_audio($post_content_original, true); } else { if (axiom_substr($post_audio, 0, 1) == '[') { $src = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'src'); if (empty($src)) { $src = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'url'); } if (empty($src)) { $src = axiom_get_post_audio($post_audio, true); } $post_audio_image = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'image'); if ($post_audio_image > 0) { $attach = wp_get_attachment_image_src($post_audio_image, 'full'); if (isset($attach[0]) && $attach[0] != '') { $post_audio_image = $attach[0]; } } if (empty($post_audio_image)) { $post_audio_image = $post_thumb; } if ($post_audio_image) { $post_audio_image = axiom_get_resized_image_url($post_audio_image, $thumb_sizes['w'], $thumb_sizes['h']); } $post_audio_title = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'title'); $post_audio_author = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'author'); $data = ($post_audio_title != '' ? ' data-title="' . esc_attr($post_audio_title) . '"' : '') . ($post_audio_author != '' ? ' data-author="' . esc_attr($post_audio_author) . '"' : '') . ($post_audio_image != '' ? ' data-image="' . esc_attr($post_audio_image) . '"' : ''); } else { $src = axiom_get_post_audio($post_audio, true); } } if ($src) { $post_audio = '<audio class="sc_audio" src="' . esc_url($src) . '"' . $data . '></audio>'; } if ($post_audio != '' && $opt['substitute_audio'] == 'yes') { $post_audio = axiom_substitute_audio($post_audio, false); } } } } if ($post_format == 'image' && !$post_thumb && !is_single()) { if (($src = axiom_get_post_image($post_content_original, $post_id)) != '') { $post_thumb = axiom_get_resized_image_tag($src, $thumb_sizes['w'], $thumb_sizes['h_crop']); } } if ($post_format == 'link') { $post_url_data = axiom_get_post_link($post_content_original, false); $post_link = $post_url = $post_url_data['url']; $post_url_target = $post_url_data['target']; } // Get all post's terms $post_taxonomy = axiom_get_taxonomy_categories_by_post_type($post_type); $post_taxonomy_tags = axiom_get_taxonomy_tags_by_post_type($post_type); $post_terms = array(); if ($opt['terms_list']) { $post_terms = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'parent_id' => $post_type == 'post' ? $opt['parent_tax_id'] : 0, 'exclude' => $post_type == 'post' ? explode(',', axiom_get_theme_option('exclude_cats')) : array())); } if ($old_post != null) { $post = $old_post; setup_postdata($post); } $post_data = compact('post_id', 'post_parent_id', 'post_protected', 'post_type', 'post_taxonomy', 'post_taxonomy_tags', 'post_format', 'post_flags', 'post_icon', 'post_link', 'post_comments_link', 'post_date_sql', 'post_date_stamp', 'post_date', 'post_date_part1', 'post_date_part2', 'post_comments', 'post_views', 'post_likes', 'post_reviews_author', 'post_reviews_users', 'post_author', 'post_author_id', 'post_author_url', 'post_title', 'post_title_plain', 'post_content_plain', 'post_content_original', 'post_content', 'post_excerpt_original', 'post_excerpt', 'post_thumb', 'post_thumb_url', 'post_attachment', 'post_gallery', 'post_video', 'post_video_image', 'post_audio', 'post_audio_image', 'post_url', 'post_url_target', 'post_terms', 'post_edit_enable', 'post_delete_enable'); return apply_filters('axiom_filter_get_post_data', $post_data, $opt, $post_obj); }