Ejemplo n.º 1
0
 function themerex_callback_check_reviews_criterias()
 {
     global $_REQUEST;
     if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) {
         die;
     }
     $response = array('error' => '', 'criterias' => '');
     $ids = explode(',', $_REQUEST['ids']);
     if (count($ids) > 0) {
         foreach ($ids as $id) {
             $id = (int) $id;
             $prop = get_category_inherited_property($id, 'reviews_criterias');
             if (!empty($prop) && !is_inherit_option($prop)) {
                 $response['criterias'] = implode(',', $prop);
                 break;
             }
         }
     }
     echo json_encode($response);
     die;
 }
Ejemplo n.º 2
0
function show_meta_box_post()
{
    global $THEMEREX_meta_box_post, $post, $THEMEREX_options;
    // Use nonce for verification
    echo '<input type="hidden" name="meta_box_post_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    // Nonce for ajax queries
    $THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce');
    $THEMEREX_ajax_url = admin_url('admin-ajax.php');
    $maxLevel = max(5, (int) get_theme_option('reviews_max_level'));
    $custom_options = get_post_meta($post->ID, 'post_custom_options', true);
    if (isset($custom_options['reviews_marks'])) {
        $custom_options['reviews_marks'] = marksToDisplay($custom_options['reviews_marks']);
    }
    $post_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_post['fields']);
    themerex_options_load_scripts();
    themerex_options_prepare_js('post');
    ?>
    
    <script type="text/javascript">
		// AJAX fields
		var THEMEREX_ajax_url = "<?php 
    echo $THEMEREX_ajax_url;
    ?>
";
		var THEMEREX_ajax_nonce = "<?php 
    echo $THEMEREX_ajax_nonce;
    ?>
";
		//var reviews_criterias = "";
		var reviews_levels = "<?php 
    echo get_theme_option('reviews_criterias_levels');
    ?>
";
		var reviews_max_level = <?php 
    echo $maxLevel;
    ?>
;
		var allowUserReviews = true;
		jQuery(document).ready(function() {
			// Init post specific meta fields
			//initPostReviews();
		});
	</script>
    
	<div class="reviews_<?php 
    echo $maxLevel;
    ?>
">

    <?php 
    themerex_options_page_start(array('data' => $post_options, 'add_inherit' => true, 'show_page_layout' => false, 'override' => 'post'));
    foreach ($post_options as $option) {
        if (!isset($option['override']) || !in_array('post', explode(',', $option['override']))) {
            continue;
        }
        $id = isset($option['id']) ? $option['id'] : '';
        $meta = isset($custom_options[$id]) ? $custom_options[$id] : '';
        if ($id == 'reviews_marks') {
            $cat_list = getCategoriesByPostId($post->ID);
            if (count($cat_list) > 0) {
                foreach ($cat_list as $cat) {
                    $id = (int) $cat['term_id'];
                    $prop = get_category_inherited_property($id, 'reviews_criterias');
                    if (!empty($prop) && !is_inherit_option($prop)) {
                        $option['options'] = $prop;
                        break;
                    }
                }
            }
        }
        themerex_options_show_field($option, $meta);
    }
    themerex_options_page_stop();
    ?>
	</div>
	<?php 
}
Ejemplo n.º 3
0
function sc_slider($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "engine" => get_custom_option('substitute_slider_engine'), "chop_effect" => "", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "border" => "none", "controls" => "no", "pagination" => "no", "titles" => "no", "descriptions" => get_custom_option('slider_descriptions'), "links" => "no", "align" => "", "interval" => "", "date_format" => "", "crop" => "on", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links;
    if (empty($width)) {
        $width = "100%";
    }
    if (empty($interval)) {
        $interval = mt_rand(5000, 10000);
    }
    if ($engine == 'chop' && !file_exists(themerex_get_file_dir('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'))) {
        $engine = 'swiper';
    }
    if ($engine == 'chop' && empty($chop_effect)) {
        $effects2D = array("vertical", "horizontal", "half", "multi");
        $effects3D = array("3DBlocks", "3DFlips");
        $chop_effect = $effects2D[min(3, mt_rand(0, 3))] . '|' . $effects3D[min(1, mt_rand(0, 1))];
    }
    $THEMEREX_sc_slider_engine = $engine;
    $THEMEREX_sc_slider_width = getStyleValue($width);
    $THEMEREX_sc_slider_height = getStyleValue($height);
    $THEMEREX_sc_slider_links = sc_param_is_on($links);
    if (empty($id)) {
        $id = "sc_slider_" . str_replace('.', '', mt_rand());
    }
    $ms = getStyleString($top, $right, $bottom, $left);
    $ws = getStyleString('', '', '', '', $width);
    $hs = getStyleString('', '', '', '', '', $height);
    $s = ($border == 'none' && !in_array($pagination, array('full', 'over')) ? $ms : '') . $hs . $ws;
    if ($border != 'none' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    if ($engine != 'flex' && $engine != 'chop' && $engine != 'swiper' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    $output = ($border != 'none' ? '<div class="sc_border sc_border_' . $border . ($align != '' && $align != 'none' ? ' sc_align' . $align : '') . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . (in_array($pagination, array('full', 'over')) ? '<div class="sc_slider_pagination_area sc_slider_pagination_' . $pagination . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . (!empty($class) ? ' ' . $class : '') . ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (sc_param_is_on($pagination) ? ' sc_slider_pagination' : ' sc_slider_nopagination') . ($border == 'none' && $align != '' && $align != 'none' ? ' sc_align' . $align : '') . ($engine == 'swiper' ? ' swiper-slider-container' : '') . '"' . ((int) $interval > 0 ? ' data-interval="' . $interval . '"' : '') . ($engine == 'chop' ? ' data-effect="' . $chop_effect . '"' : '') . ($s != '' ? ' style="' . $s . '"' : '') . '>';
    $pagination_items = '';
    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 == 'chop' || $engine == 'swiper') {
                $imageAsBackground = $engine != 'chop';
                $caption = '';
                $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);
                    $args = addFiltersInQuery($args, array('thumbs'));
                    $args = addPostsAndCatsInQuery($args, $ids, $cat);
                    $query = new WP_Query($args);
                    $numSlide = 0;
                    while ($query->have_posts()) {
                        $query->the_post();
                        $numSlide++;
                        $post_id = get_the_ID();
                        $post_title = get_the_title();
                        $post_link = get_permalink();
                        $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 (sc_param_is_on($crop)) {
                            $post_attachment = $imageAsBackground ? getResizedImageURL($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null) : getResizedImageTag($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null);
                        } else {
                            if (!$imageAsBackground) {
                                $post_attachment = '<img src="' . $post_attachment . '" alt="">';
                            }
                        }
                        $post_accent_color = '';
                        $post_category = '';
                        $post_category_link = '';
                        if (in_array($pagination, array('full', 'over'))) {
                            // Get all post's tags
                            $post_tags_links = '';
                            if (($post_tags_list = get_the_tags()) != 0) {
                                $tag_number = 0;
                                foreach ($post_tags_list as $tag) {
                                    $tag_number++;
                                    $post_tags_links .= '<span class="slide_tag">' . $tag->name . ($tag_number == count($post_tags_list) ? '' : ',') . '</span> ';
                                }
                            }
                            $pagination_items .= '<li' . (empty($pagination_items) ? ' class="' . ($engine == 'chop' ? 'cs-active-pagination' : 'active') . '"' : '') . '>' . '<div class="slide_pager">' . '<div class="slide_date">' . $post_date . '</div>' . '<div class="slide_info">' . '<h4 class="slide_title">' . $post_title . '</h4>' . '<div class="slide_tags">' . $post_tags_links . '</div>' . '</div>' . '</div>' . '</li>';
                        }
                        $output .= '<li' . ' class="' . $engine . '-slide' . ($engine == 'chop' && $numSlide == 1 ? ' cs-activeSlide' : '') . '"' . ' style="' . ($engine == 'chop' && $numSlide == 1 ? 'display:block;' : '') . ($imageAsBackground ? 'background-image:url(' . $post_attachment . ');' : '') . $ws . $hs . '"' . '>' . (sc_param_is_on($links) ? '<a href="' . $post_link . '" title="' . htmlspecialchars($post_title) . '">' : '') . (!$imageAsBackground ? $post_attachment : '');
                        $caption = $engine == 'swiper' || $engine == 'flex' ? '' : $caption;
                        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($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 .= ($engine == 'chop' ? '<div class="sc_slider_info_item">' : '') . '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '"' . ($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_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 != '') {
                                    $caption .= '<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>';
                                }
                            }
                            $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') {
                                $caption .= $output_reviews;
                            }
                            $caption .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>';
                            if (get_custom_option("slider_info_category") != 'yes') {
                                $caption .= $output_reviews;
                            }
                            if ($descriptions > 0) {
                                $caption .= '<div class="sc_slider_descr">' . getShortString($post_descr, $descriptions) . '</div>';
                            }
                            $caption .= '</div>' . ($engine == 'chop' ? '</div>' : '');
                        }
                        $output .= ($engine == 'swiper' || $engine == 'flex' ? $caption : '') . (sc_param_is_on($links) ? '</a>' : '') . '</li>';
                    }
                    wp_reset_postdata();
                }
                $output .= '</ul>';
                if ($engine == 'swiper' || $engine == 'chop') {
                    if (sc_param_is_on($controls)) {
                        $output .= '
					<ul class="flex-direction-nav">
					<li><a class="flex-prev" href="#"></a></li>
					<li><a class="flex-next" href="#"></a></li>
					</ul>';
                    }
                    if (sc_param_is_on($pagination)) {
                        $output .= '<div class="flex-control-nav"></div>';
                    }
                }
                if ($engine == 'chop') {
                    $output .= '
				<div class="sc_slider_info_slides">' . $caption . '</div>
				<div class="sc_slider_info_holder"></div>
				';
                }
            } else {
                $output = '';
            }
        }
    }
    if (!empty($output)) {
        $output .= '</div>' . ($border != 'none' ? '</div>' : '');
        if ($pagination_items) {
            $output .= '
				<div class="flex-control-nav manual"' . ($hs ? ' style="' . $hs . '"' : '') . '>
					<div id="' . $id . '_scroll" class="sc_scroll sc_scroll_vertical swiper-slider-container scroll-container"' . ($hs ? ' style="' . $hs . '"' : '') . '>
						<div class="sc_scroll_wrapper swiper-wrapper">
							<div class="sc_scroll_slide swiper-slide">
								<ul>' . $pagination_items . '</ul>
							</div>
						</div>
						<div id="' . $id . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_vertical"></div>
					</div>
				</div>';
            $output .= '</div>';
        }
    }
    return $output;
}
Ejemplo n.º 4
0
 function themerex_get_post_data_for_theme($post_data, $opt, $post_obj)
 {
     $post_data['post_accent_color'] = $opt['parent_cat_id'] > 0 ? empty($opt['accent_color']) ? get_category_inherited_property($opt['parent_cat_id'], 'theme_accent_color') : $opt['accent_color'] : '';
     if ($post_data['post_accent_color'] == '') {
         $ex_cats = explode(',', get_theme_option('exclude_cats'));
         for ($i = 0; $i < count($post_data['post_categories_list']); $i++) {
             if (in_array($post_data['post_categories_list'][$i]['term_id'], $ex_cats)) {
                 continue;
             }
             if (get_theme_option('close_category') == 'parental') {
                 $parent_cat = getParentCategory($post_data['post_categories_list'][$i]['term_id'], $opt['parent_cat_id']);
                 if ($parent_cat) {
                     $post_data['post_accent_color'] = get_category_inherited_property($parent_cat['term_id'], 'theme_accent_color');
                 }
             } else {
                 $post_data['post_accent_color'] = get_category_inherited_property($post_categories_list[$i]['term_id'], 'theme_accent_color');
             }
             if ($post_data['post_accent_color'] != '') {
                 break;
             }
         }
     }
     return $post_data;
 }
Ejemplo n.º 5
0
function get_custom_option($name, $defa = null, $post_id = 0, $cat_id = 0)
{
    if (isset($_GET[$name])) {
        $rez = $_GET[$name];
    } else {
        if ($cat_id > 0) {
            $rez = get_category_inherited_property($cat_id, $name);
            if ($rez == '') {
                $rez = get_theme_option($name, $defa);
            }
        } else {
            if ($post_id > 0) {
                $rez = get_theme_option($name, $defa);
                $custom_options = get_post_meta($post_id, 'post_custom_options', true);
                if (isset($custom_options[$name]) && !is_inherit_option($custom_options[$name])) {
                    $rez = $custom_options[$name];
                } else {
                    if (is_category()) {
                        $categories = array();
                        $categories[] = get_queried_object();
                    } else {
                        $categories = getCategoriesByPostId($post_id);
                    }
                    $tmp = '';
                    for ($cc = 0; $cc < count($categories) && (empty($tmp) || is_inherit_option($tmp)); $cc++) {
                        $tmp = get_category_inherited_property(is_object($categories[$cc]) ? $categories[$cc]->term_id : $categories[$cc]['term_id'], $name);
                    }
                    if ($tmp != '') {
                        $rez = $tmp;
                    }
                }
            } else {
                global $THEMEREX_post_options, $THEMEREX_cat_options, $THEMEREX_custom_options, $THEMEREX_shop_options;
                if (isset($THEMEREX_custom_options[$name])) {
                    $rez = $THEMEREX_custom_options[$name];
                } else {
                    $rez = get_theme_option($name, $defa);
                    if (is_woocommerce_page() && isset($THEMEREX_shop_options[$name]) && !is_inherit_option($THEMEREX_shop_options[$name])) {
                        $rez = is_array($THEMEREX_shop_options[$name]) ? $THEMEREX_shop_options[$name][0] : $THEMEREX_shop_options[$name];
                    }
                    if (!is_single() && isset($THEMEREX_post_options[$name]) && !is_inherit_option($THEMEREX_post_options[$name])) {
                        $rez = is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name];
                    }
                    if (isset($THEMEREX_cat_options[$name]) && !is_inherit_option($THEMEREX_cat_options[$name])) {
                        $rez = $THEMEREX_cat_options[$name];
                    }
                    if (is_single() && isset($THEMEREX_post_options[$name]) && !is_inherit_option($THEMEREX_post_options[$name])) {
                        $rez = is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name];
                    }
                    if (get_theme_option('show_theme_customizer') == 'yes') {
                        $tmp = getValueGPC($name, $rez);
                        if (!is_inherit_option($tmp)) {
                            $rez = $tmp;
                        }
                    }
                    $THEMEREX_custom_options[$name] = $rez;
                }
            }
        }
    }
    return $rez;
}
Ejemplo n.º 6
0
function prepareThemeCustomStyles()
{
    // Custom font
    $fonts = getThemeFontsList(false);
    $theme_font = get_custom_option('theme_font');
    $header_font = get_custom_option('header_font');
    $theme_color = get_custom_option('theme_color');
    $theme_accent_color = get_custom_option('theme_accent_color');
    $background_color = get_custom_option('body_bg_color');
    $logo_widht = get_custom_option('logo_block_width');
    //theme fonts
    if (isset($fonts[$theme_font])) {
        addThemeCustomStyle('
			body, button, input, select, textarea { font-family: \'' . $theme_font . '\', ' . $fonts[$theme_font]['family'] . '; }');
    }
    // heading fonts
    if (isset($fonts[$header_font])) {
        addThemeCustomStyle((get_theme_option('show_theme_customizer') == 'yes' ? '.custom_options .co_label, .custom_options .co_header span, ' : '') . 'h1, h2, h3, h4, h5, h6,
			.h1,.h2,.h3,.h4,.h5,.h6,
			#header,
			.logoHeader, .subTitle,
			.widget_calendar table caption,
			.sc_button,
			.widget_calendar,
			.widget_search .searchFormWrap .searchSubmit,
			.sc_video_frame .sc_video_frame_info_wrap .sc_video_frame_info .sc_video_frame_player_title,
			.widget_popular_posts .ui-tabs-nav li a,
			.format-quote .sc_quote,
			.sc_tabs ul.sc_tabs_titles li a,
			.sc_testimonials_item_quote,
			.sc_testimonials_item_user,
			.sc_price_item,
			.sc_pricing_table .sc_pricing_item ul li.sc_pricing_title,
			.sc_skills_arc .sc_skills_legend li,
			.sc_skills_counter,
			.sc_countdown_flip .flip-clock-wrapper ul,
			.sc_countdown_round .countdown-amount{ font-family: \'' . $header_font . '\',\'' . $theme_font . '\', ' . $fonts[$header_font]['family'] . '; }');
    }
    //Custom heading H1-H6
    $hCounter = 1;
    while ($hCounter <= 6) {
        $heading_array = array();
        $heading_array[] = 'letter-spacing:' . (get_custom_option('header_font_spacing_h' . $hCounter) != '' ? get_custom_option('header_font_spacing_h' . $hCounter) : 0) . 'px;';
        $heading_array[] = 'font-size:' . get_custom_option('header_font_size_h' . $hCounter) . 'px;';
        $heading_array[] = get_custom_option('header_font_uppercase_h' . $hCounter) == 'yes' ? 'text-transform: uppercase;' : 'text-transform: capitalize;';
        $heading_array[] = 'font-style:' . get_custom_option('header_font_style_h' . $hCounter) . ';';
        $heading_array[] = 'font-weight:' . get_custom_option('header_font_weight_h' . $hCounter) . ';';
        $heading_array[] = 'line-height:' . round(get_custom_option('header_font_size_h' . $hCounter) * 1.2) . 'px;';
        $heading_array[] = 'margin: 0 0 ' . round(get_custom_option('header_font_size_h' . $hCounter) / 2) . 'px 0;';
        $extra_h2 = $hCounter == 2 ? ', .sc_video_frame .sc_video_frame_info_wrap .sc_video_frame_info .sc_video_frame_player_title' : '';
        addThemeCustomStyle('h' . $hCounter . $extra_h2 . '{ ' . (!empty($heading_array) ? join(' ', $heading_array) : '') . ' }');
        $hCounter++;
    }
    //Custom logo style
    if (get_custom_option('logo_type') == 'logoImage') {
        //images style
        addThemeCustomStyle('
			.wrap.logoImageStyle .logoHeader{ width:' . $logo_widht . 'px; }
			.wrap.logoImageStyle .logo_bg_size{ border-width: 45px ' . $logo_widht / 2 . 'px 0 ' . $logo_widht / 2 . 'px; }
			.menu-logo{ width:' . $logo_widht . 'px; }');
    } else {
        //logo text style
        $style_logo_array = array();
        $style_logo_array[] = 'font-family:"' . get_custom_option('logo_font') . '";';
        $style_logo_array[] = 'font-style:' . get_custom_option('logo_font_style') . ';';
        $style_logo_array[] = 'font-weight:' . get_custom_option('logo_font_weight') . ';';
        $style_logo_array[] = 'font-size:' . get_custom_option('logo_font_size') . 'px;';
        $style_logo_array[] = 'line-height:' . get_custom_option('logo_font_size') . 'px;';
        addThemeCustomStyle('
			.wrap.logoTextStyle .logoHeader{ width:' . $logo_widht . 'px; ' . (!empty($style_logo_array) ? join(' ', $style_logo_array) : '') . ' }
			.wrap.logoTextStyle .logo_bg_size{ border-width: 45px ' . $logo_widht / 2 . 'px 0 ' . $logo_widht / 2 . 'px; } 
			.menu-logo{ width:' . $logo_widht . 'px; }
			.wrapTopMenu .topMenu .logo a{' . (!empty($style_logo_array) ? join(' ', $style_logo_array) : '') . '}');
    }
    //background custom style
    if (get_custom_option('body_style') == 'boxed') {
        $style_custom_array = array();
        get_custom_option('bg_color') != '' ? $style_custom_array[] = get_custom_option('bg_color') : '';
        if (get_custom_option('bg_custom_image') != '') {
            $style_custom_array[] = 'url(' . get_custom_option('bg_custom_image') . ')';
            $style_custom_array[] = get_custom_option('bg_custom_image_position_x');
            $style_custom_array[] = get_custom_option('bg_custom_image_position_y');
            $style_custom_array[] = get_custom_option('bg_custom_image_repeat');
            $style_custom_array[] = get_custom_option('bg_custom_image_attachment');
        }
        addThemeCustomStyle('
			.wrap{ background-color: ' . (!empty($style_custom_array) ? join(' ', $style_custom_array) : '') . ';}');
        addThemeCustomStyle('
		 	.bodyStyleBoxed .wrapBox{background-color: ' . get_custom_option('body_bg_color') . ';}');
    }
    if ($theme_color == '') {
        $theme_color = '#5ea281';
    }
    if ($theme_accent_color == '') {
        $theme_accent_color = '#a7d692';
    }
    //theme color
    if ($theme_color != '') {
        addThemeCustomStyle('
		/*color*/
		a, h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover,
		.h1 a:hover,.h2 a:hover,.h3 a:hover,.h4 a:hover,.h5 a:hover,.h6 a:hover,
		.logoHeader a, .subTitle, 
		#header .rightTop a,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li.sfHover > a,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li a:hover,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li.menu-item-has-children:after,
		.widget_twitter ul > li:before,
		.widget_twitter ul > li a,
		.widget_rss ul li a,
		.widget_trex_post .ui-tabs-nav li a,
		.nav_pages ul li a:hover,
		.postFormatIcon:before,
		.comments .commentModeration .icon,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_quote, blockquote,
		.sc_toggl.sc_toggl_style_1 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_2 .sc_toggl_item .sc_toggl_title:hover,
		.sc_dropcaps.sc_dropcaps_style_3 .sc_dropcap,
		.sc_highlight.sc_highlight_style_2 ,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.sc_tabs.sc_tabs_style_1 ul li.ui-tabs-active a,
		.sc_testimonials .sc_testimonials_item_author .sc_testimonials_item_user,
		ul.sc_list.sc_list_style_iconed li:before,
		ul.sc_list.sc_list_style_iconed.sc_list_marked_yes li,
		ul.sc_list.sc_list_style_iconed li.sc_list_marked_yes ,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_quote, blockquote,
		.sc_dropcaps.sc_dropcaps_style_3 .sc_dropcap,
		.sc_team .sc_team_item:hover .sc_team_item_title,
		.sc_team .sc_team_item:hover .sc_team_item_position,
		.sc_countdown.sc_countdown_round .sc_countdown_counter .countdown-section .countdown-amount,
		.sc_countdown .flip-clock-wrapper ul li a div div.inn,
		.isotopeWrap .fullItemWrap .fullItemClosed:hover,
		.postInfo .postReview .revBlock .ratingValue,
		.reviewBlock .reviewTab .revTotalWrap .revTotal .revRating,
		.reviewBlock .reviewTab .revWrap .revBlock .ratingValue,
		.sc_countdown.sc_countdown_round .sc_countdown_counter .countdown-section:after,
		.isotopeWrap .isotopeItem .isotopeContent .isotopeTitle a:hover,
		.sc_toggl.sc_toggl_style_4.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:before,
		.sc_toggl.sc_toggl_style_4 .sc_toggl_item.sc_active .sc_toggl_title,
		.sc_table.sc_table_style_1 table tbody tr td.first,
		.sc_table.sc_table_style_1 table thead tr th.first,.sc_skills_counter .sc_skills_item.sc_skills_style_1 .sc_skills_count,
                .sc_skills_counter .sc_skills_item.sc_skills_style_2 .sc_skills_count,
		.sc_quote.sc_quote_style2 .icon-quote, blockquote.sc_quote_style2 .icon-quote,
		.author .authorInfo .authorTitle a, 
		.comments .commentInfo .commAuthor a,
		.comments .commentInfo .commReply a,
		.comments .commentInfo .commAuthor,
		.sc_slider_swiper .slides li .sc_slider_info a:hover,
		.sc_testimonials .sc_testimonials_item_author .sc_testimonials_item_user,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_controls .slider-control-nav li a:before,
		ul.sc_list.sc_list_style_iconed li:before,
		ul.sc_list.sc_list_style_iconed.sc_list_marked_yes li,
		ul.sc_list.sc_list_style_iconed li.sc_list_marked_yes,
		.sc_chat .sc_quote_title,
		.sc_aside_title,
		.post.type-post.format-link a p,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_quote, blockquote,
		.sc_quote .sc_quote_title, blockquote .sc_quote_title,
		.sc_toggl.sc_toggl_style_1 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_1 .sc_toggl_item .sc_toggl_title:hover a,
		.sc_toggl.sc_toggl_style_2 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_4 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_4 .sc_toggl_item .sc_toggl_title:hover a,
		.sc_dropcaps.sc_dropcaps_style_3 .sc_dropcap,
		.sc_countdown.sc_countdown_round .sc_countdown_counter .countdown-section .countdown-amount,
		.sc_highlight.sc_highlight_style_2,
		.sc_highlight.sc_highlight_style_2 a,
		.sc_pricing_table:not(.sc_pricing_table_blue).sc_pricing_table_style_1 .sc_pricing_price,
		.sc_pricing_table:not(.sc_pricing_table_blue).sc_pricing_table_style_2 .sc_pricing_price,
		.sc_pricing_table:not(.sc_pricing_table_blue).sc_pricing_table_style_3  .sc_button.sc_button_skin_global,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.logoHeader a,
		.subTitle,
		.wrapTopMenu .topMenu > ul > li > a:hover,
		.hideMenuDisplay .usermenuArea > ul > li > a,
		.menuStyle1 #header ul > li > ul li.sfHover > a,
		.menuStyle1 #header ul > li > ul li a:hover,
		.menuStyle2 #header ul > li > ul li.sfHover > a,
		.menuStyle2 #header ul > li > ul li a:hover,
		.widgetWrap ul > li,
		.widget_twitter ul > li:before,
		.widget_twitter ul > li a,
		.widget_rss ul li a,
		.widget_trex_post .ui-tabs-nav li a,
		.revItem .revBlock .ratingValue,
		.reviewBlock .reviewTab .revWrap .revBlock .ratingValue,
		.reviewBlock .reviewTab .revTotalWrap .revTotal .revRating,
		.nav_pages ul li a:hover,
		.hoverUnderline a:hover,
		.postFormatIcon:before,
		.page404 .title404,
		.comments .commentModeration .icon,
		.isotopeWrap .isotopeItem .isotopeContent .isotopeTitle a:hover,
		.isotopeWrap .fullItemWrap .fullItemClosed:hover,
		.isotopeWrap .fullItemWrap .isotopeNav:hover,
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_price,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_price,
		li.sc_list_item.sc_list_marked_yes,
		.isotopeWrap .isotopeItem .isotopeContent .isotopeCats a:hover,
		.sc_contact_info .sc_contact_info_name,
		.woocommerce .star-rating:before, .woocommerce .star-rating:before,
		.woocommerce .star-rating span, .woocommerce .star-rating span,
		.woocommerce #reviews #comments ol.commentlist li .comment-text p.meta strong ,
		table.shop_table.cart th, .wrapTopMenu .topMenu div > ul > li > a:hover,
		.sideBarWide .sc_button.sc_button_skin_dark.sc_button_style_bg:hover,
		.sideBarWide .postSharing .postSpan .revInfo:hover, .sc_required, q,
		.widget_trex_post .post_item .post_wrapper .post_title a:hover ,
		.widgetWrap ul > li a:hover,
		.sideBar a:hover{ color: ' . $theme_color . '; }
		
		.woocommerce div.product .woocommerce-tabs ul.tabs li.active a{color: ' . $theme_color . ' !important; }

		input[type="search"]::-webkit-search-cancel-button {color: ' . $theme_color . ';}
		
		/*border*/
		.isotopeWrap .isotopeItem .isotopeRating{ border-color: ' . $theme_color . ' transparent;}
		.woocommerce ul.products li.product a:hover img {border-bottom: 2px solid ' . $theme_color . ' !important;}

		.nav_pages ul li a:hover,
		.wrapTopMenu .topMenu > ul > li > ul,
		.menuStyle1 .wrapTopMenu .topMenu > ul > li > ul > li ul,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul > li ul,
		.widget_trex_post .ui-tabs-nav li a,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_tooltip,
		.sc_tooltip .sc_tooltip_item,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.sc_tabs.sc_tabs_style_2 ul li + li a,
		.sc_tabs.sc_tabs_style_2 .sc_tabs_array,
		.sc_banner:before,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_banner:before,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.sc_tabs.sc_tabs_style_2 ul li + li a,
		.sc_tabs.sc_tabs_style_2 .sc_tabs_array,,
		.wrapTopMenu .topMenu > ul > li > ul,
		.usermenuArea > ul > li > ul,
		.menuStyle2 #header ul > li > ul > li ul,
		.widget_calendar table tbody td#today span,
		.widget_trex_post .ui-tabs-nav li a,
		.nav_pages ul li a:hover, .sc_tabs.sc_tabs_style_2 ul.sc_tabs_titles li.ui-tabs-active a{ border-color: ' . $theme_color . '; }

		.sc_tooltip .sc_tooltip_item:before,
		.logoStyleBG .logoHeader .logo_bg_size,
		.isotopeWrap .isotopeItem .isotopeRating:after,
		.sc_slider_swiper .sc_slider_info .sc_slider_reviews_short:after,
		.sc_tooltip .sc_tooltip_item:before,
		.logoStyleBG .logoHeader .logo_bg_size { border-color: ' . $theme_color . ' transparent transparent transparent; }

		.widget_recent_reviews .post_item .post_wrapper .post_info .post_review:after{ border-color: transparent transparent transparent ' . $theme_color . '; }
		.buttonScrollUp { border-color: transparent transparent ' . $theme_color . ' transparent; }
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_author_show .sc_testimonials_item_quote:after { border-left-color: ' . $theme_color . '; }

		.widget_calendar table tbody td#today { outline: 1px solid ' . $theme_color . '; }
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_author_show .sc_testimonials_item_quote:after{  border-left-color: ' . $theme_color . '; }
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_title,
		.sc_tooltip{border-bottom-color: ' . $theme_color . ';}
		.postInfo .stickyPost:after{ border-color: transparent transparent transparent ' . $theme_color . '; }


		/*background*/
		#header .openTopMenu,
		.menuStyle1 .wrapTopMenu .topMenu > ul > li > ul > li ul,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li a:before,
		.widget_calendar table tbody td a:before,
		.widget_calendar table tbody td a:hover, 
		.widget_tag_cloud a:hover,
		.widget_trex_post .ui-tabs-nav li.ui-state-active a,
		.nav_pages ul li span,
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_video_frame.sc_video_active:before,
		.sc_toggl.sc_toggl_style_2.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:after,
		.sc_toggl.sc_toggl_style_3 .sc_toggl_item .sc_toggl_title ,
		.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
		.sc_tooltip .sc_tooltip_item,
		.sc_table.sc_table_style_2 table thead tr th,
		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_title,
		.sc_scroll .sc_scroll_bar .swiper-scrollbar-drag,
		.sc_skills_bar .sc_skills_item .sc_skills_count ,
		.sc_skills_bar.sc_skills_vertical .sc_skills_item .sc_skills_count ,
		.sc_icon.sc_icon_box,
		.sc_icon.sc_icon_box_circle,
		.sc_icon.sc_icon_box_square,
		.sc_slider.sc_slider_dark .slider-pagination-nav span.swiper-active-switch ,
		.sc_slider.sc_slider_light .slider-pagination-nav span.swiper-active-switch,
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_quote,
		.sc_testimonials.sc_testimonials_style_2 .sc_testimonials_title:after,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_pagination .slider-pagination-nav span.swiper-active-switch,
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_video_frame.sc_video_active:before,
		.sc_loader_show:before,
		.sc_toggl.sc_toggl_style_2.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:after ,
		.sc_toggl.sc_toggl_style_3 .sc_toggl_item .sc_toggl_title ,
		.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
		.postInfo .postReview .revBlock.revStyle100 .ratingValue,
		.reviewBlock .reviewTab .revWrap .revBlock.revStyle100 .ratingValue,
		.post-password-required .post-password-form input[type="submit"]:hover,
		.sc_button.sc_button_skin_dark.sc_button_style_bg:hover, 
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_skills_counter .sc_skills_item.sc_skills_style_3 .sc_skills_count,
		.sc_skills_counter .sc_skills_item.sc_skills_style_4 .sc_skills_count,
		.isotopeFiltr ul li.active a,
		.sc_slider.sc_slider_dark .slider-pagination-nav span.swiper-active-switch,
		.sc_slider.sc_slider_light .slider-pagination-nav span.swiper-active-switch,
		.sc_slider_swiper .sc_slider_info .sc_slider_reviews_short span.rInfo,
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_quote,
		.sc_testimonials.sc_testimonials_style_2 .sc_testimonials_title:after,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_pagination .slider-pagination-nav span.swiper-active-switch,
		.sc_video_frame.sc_video_active:before,
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_button.sc_button_style_regular:hover,
		.sc_toggl.sc_toggl_style_2.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:after,
		.sc_toggl.sc_toggl_style_3 .sc_toggl_item .sc_toggl_title,
		.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
		.sc_tooltip .sc_tooltip_item,
		.sc_table.sc_table_style_2 table thead tr th,
		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul,
		.sc_scroll .sc_scroll_bar .swiper-scrollbar-drag,
		.sc_skills_bar .sc_skills_item .sc_skills_count,
		.sc_skills_bar.sc_skills_vertical .sc_skills_item .sc_skills_count,
		.sc_icon.sc_icon_box,
		.sc_icon.sc_icon_box_square,
		.sc_icon.sc_icon_box_circle,
		.sc_tabs.sc_tabs_style_2 ul.sc_tabs_titles li.ui-tabs-active a,
		#header .openTopMenu,
		.openMobileMenu,
		.hideMenuDisplay .usermenuArea > ul > li > a:before,
		.menuStyle2 #header ul > li > ul li a:before,
		.widget_calendar table tbody td a:before,
		.widget_calendar table tbody td a:hover,
		.widget_tag_cloud a:hover,
		.widget_recent_reviews .post_item .post_wrapper .post_info .post_review,
		.widget_trex_post .ui-tabs-nav li.ui-state-active a,
		.postInfo .stickyPost .postSticky,
		.revItem .revBlock.revStyle100 .ratingValue,
		.reviewBlock .reviewTab .revWrap .revBlock.revStyle100 .ratingValue,
		.nav_pages ul li span,
		.subCategory,
		.sc_highlight.sc_highlight_style_1,
		.sc_tooltip .sc_tooltip_item,
		.widget_search .searchFormWrap .searchSubmit input,
		#header .usermenuArea ul.usermenuList .usermenuCart .widget_area p.buttons a:hover{ background-color: ' . $theme_color . '; }

		.woocommerce ul.products li.product a.button:hover,
		.woocommerce div.product form.cart .button:hover,
		.woocommerce input.button:hover{ background-color: ' . $theme_color . ' !important;} 

		.sc_button.sc_button_style_regular:hover, .woocommerce #review_form #respond .form-submit input:hover{ background-color: ' . $theme_color . ' !important; }

		::selection { color: #fff; background-color:' . $theme_color . ';}
		::-moz-selection { color: #fff; background-color:' . $theme_color . ';}');
    }
    //theme accent color
    if ($theme_accent_color != '') {
        addThemeCustomStyle('
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul,
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_2  .sc_button.sc_button_skin_global.sc_button_style_bg ,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul,
		.sc_skills_bar .sc_skills_item ,
		.sc_skills_counter .sc_skills_item.sc_skills_style_4 .sc_skills_info,
		.sc_tabs.sc_tabs_style_3 ul.sc_tabs_titles li,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_pagination .slider-pagination-nav span,
		footer.footer_style_green .widget_tag_cloud a,
		.widget_tag_cloud a,
		.isotopeFiltr ul li a ,
		.themeDark .isotopeFiltr ul li.active a,
		.isotopeFiltr ul li a:hover{ background-color: ' . $theme_accent_color . ';}

		.woocommerce ul.products li.product a.button,
		.woocommerce div.product form.cart .button,
		.woocommerce #content .quantity .plus:hover, 
		.woocommerce #content .quantity .minus:hover,
		.woocommerce input.button  { background-color: ' . $theme_accent_color . ' !important; background: ' . $theme_accent_color . ' !important;}

		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_title{border-bottom-color: ' . $theme_accent_color . ';}

		.sc_team .sc_team_item .sc_team_item_border,
		.woocommerce .quantity input.qty, 
		.woocommerce #content .quantity input.qty, 
		.woocommerce .quantity input.qty, 
		.woocommerce #content .quantity input.qty,
		.woocommerce #content .quantity .plus, 
		.woocommerce #content .quantity .minus,
		.woocommerce .quantity .plus, 
		.woocommerce .quantity .minus{border-color: ' . $theme_accent_color . ';}

		.sc_team .sc_team_item .sc_team_item_socials ul li a:hover span,
		footer.footer_style_green .widgetWrap ul > li a,
		.sc_icons_widget .sc_icons_item{ color: ' . $theme_accent_color . '; }

		.woocommerce #content div.product div.images a {border: 2px solid ' . $theme_accent_color . ' !important;}
		');
    }
    if ($background_color != '') {
        addThemeCustomStyle('
			
			body{ background-color: ' . $background_color . '; }
			.rsUni, .rsUni .rsOverflow, .rsUni .rsSlide, .rsUni .rsVideoFrameHolder, .rsUni .rsThumbs{ background-color: ' . $background_color . ' !important; }
			.woocommerce #content div.product .woocommerce-tabs ul.tabs li.active{border-bottom: 1px solid ' . $background_color . '; }
		');
    }
    // Custom menu
    if (get_theme_option('menu_colored') == 'yes') {
        $menu_name = 'mainmenu';
        if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
            $menu = wp_get_nav_menu_object($locations[$menu_name]);
            if (is_object($menu) && $menu) {
                $menu_items = wp_get_nav_menu_items($menu->term_id);
                $menu_styles = '';
                $menu_slider = get_theme_option('menu_slider') == 'yes';
                if (count($menu_items) > 0) {
                    foreach ($menu_items as $k => $item) {
                        //				if ($item->menu_item_parent==0) {
                        $cur_accent_color = '';
                        if ($item->type == 'taxonomy' && $item->object == 'category') {
                            $cur_accent_color = get_category_inherited_property($item->object_id, 'theme_accent_color');
                        }
                        if ((empty($cur_accent_color) || is_inherit_option($cur_accent_color)) && isset($item->classes[0]) && !empty($item->classes[0])) {
                            $cur_accent_color = (themerex_substr($item->classes[0], 0, 1) != '#' ? '#' : '') . $item->classes[0];
                        }
                        if (!empty($cur_accent_color) && !is_inherit_option($cur_accent_color)) {
                            $menu_styles .= ($item->menu_item_parent == 0 ? "#header_middle_inner #mainmenu li.menu-item-{$item->ID}.current-menu-item > a," : '') . "\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} > a:hover,\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.sfHover > a { background-color: {$cur_accent_color} !important; }\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} ul { background-color: {$cur_accent_color} !important; } ";
                        }
                        if ($menu_slider && $item->menu_item_parent == 0) {
                            $menu_styles .= "\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over:not(.current-menu-item) > a:hover,\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over.sfHover > a { background-color: transparent !important; } ";
                        }
                        //				}
                    }
                }
                if (!empty($menu_styles)) {
                    addThemeCustomStyle($menu_styles);
                }
            }
        }
    }
    //main menu responsive width
    //
    $menu_responsive = get_theme_option('responsive_menu_width') . 'px';
    addThemeCustomStyle("\r\n\t\t@media (min-width: {$menu_responsive}) { \r\n\t\t\t.logo_center .logoHeader, .logo_center #mainmenu{display: none;}\r\n\t\t}\r\n\r\n\t\t@media (max-width: {$menu_responsive}) { \r\n\t\t\t.openMobileMenu{ display: block; }\r\n\t\t\t.menuStyleFixed #header.fixedTopMenuShow .menuFixedWrap{ position: static !important; }\r\n\t\t\t.wrapTopMenu .topMenu { width: 100%;  }\r\n\t\t\t.wrapTopMenu .topMenu > ul{ display: none;  clear:both; }\r\n\t\t\t.wrapTopMenu .topMenu > ul li{ display: block; clear:both;  border-top: 1px solid #ddd; padding: 10px 0; text-align: center !important;}\r\n\t\t\t.wrapTopMenu .topMenu > ul li a{ }\r\n\t\t\t.wrapTopMenu .topMenu > ul li ul{ position: static !important; width:auto !important; margin:0 !important; border: none !important; text-align:center; background-color: transparent !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul:before{ display:none;}\r\n\t\t\t.openTopMenu{ display: none; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li.sfHover > a:before,\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > a{ line-height: 30px !important;  opacity:1 !important; height: auto !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > a:hover:before{ left:10px; right:10px; }\r\n\t\t\t.hideMenuDisplay .wrapTopMenu{ min-height: 45px !important; height: auto !important;}\r\n\t\t\t.hideMenuDisplay .usermenuArea > ul li a{ color: #fff !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul:after{content: none;}\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul li:last-child {padding-bottom: 0 !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul li.menu-item-has-children {padding: 10px 0; }\r\n\t\t\t.menuStyle1 #header ul > li > ul > li ul:before, .menuStyle1 #header ul > li > ul > li ul:after, .menuStyle1 #header ul > li > ul li.menu-item-has-children:after{display: none;}\r\n\t\t\t.logo_center .topMenu .newMenu, .logo_center .topMenu .logo {display: none !important;}\r\n\t\t\t.wrap.logoImageStyle .logoHeader {padding-top: 20px;}\r\n\t\t}\r\n\t");
    // Main menu height
    $menu_height = (int) get_theme_option('menu_height');
    if ($menu_height > 20) {
        addThemeCustomStyle("\r\n\t\t\t#mainmenu > li > a { height: {$menu_height}px !important; line-height: {$menu_height}px !important; }\r\n\t\t\t#mainmenu > li ul { top: {$menu_height}px !important; }\r\n\t\t\t#header_middle { min-height: {$menu_height}px !important; } ");
    }
    // Submenu width
    $menu_width = (int) get_custom_option('menu_width');
    if ($menu_width > 50) {
        addThemeCustomStyle('
			.wrapTopMenu .topMenu > ul > li > ul { width: ' . $menu_width . 'px; margin: 0 0 0 -' . ($menu_width + 30) / 2 . 'px; }
			#mainmenu > li:nth-child(n+6) ul li ul { left: -' . $menu_width . 'px; } ');
    }
    // Custom css from theme options
    $css = get_theme_option('custom_css');
    if (!empty($css)) {
        addThemeCustomStyle($css);
    }
    return getThemeCustomStyles();
}
Ejemplo n.º 7
0
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;
}
function prepareThemeCustomStyles()
{
    // Custom font
    $fonts = getThemeFontsList(false);
    $font = get_custom_option('theme_font');
    $body_bg = get_custom_option('bg_color');
    $theme_color = get_custom_option('theme_color');
    if (isset($fonts[$font])) {
        addThemeCustomStyle("\n\t\t\tbody, button, input, select, textarea {\n\t\t\t\tfont-family: '" . $font . "', " . $fonts[$font]['family'] . ";\n\t\t\t}\n\t\t\tbody {\n\t\t\t\tbackground: " . $body_bg . "\n\t\t\t}\n\t\t");
    }
    // Custom menu
    if (get_custom_option('menu_colored') == 'yes') {
        $menu_name = 'mainmenu';
        if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
            $menu = wp_get_nav_menu_object($locations[$menu_name]);
            if (is_object($menu) && $menu) {
                $menu_items = wp_get_nav_menu_items($menu->term_id);
                $menu_styles = '';
                $menu_slider = get_custom_option('menu_slider') == 'yes';
                if (count($menu_items) > 0) {
                    foreach ($menu_items as $k => $item) {
                        //				if ($item->menu_item_parent==0) {
                        $cur_accent_color = '';
                        if ($item->type == 'taxonomy' && $item->object == 'category') {
                            $cur_accent_color = get_category_inherited_property($item->object_id, 'theme_accent_color');
                        }
                        if ((empty($cur_accent_color) || is_inherit_option($cur_accent_color)) && isset($item->classes[0]) && !empty($item->classes[0])) {
                            $cur_accent_color = (themerex_substr($item->classes[0], 0, 1) != '#' ? '#' : '') . $item->classes[0];
                        }
                        if (!empty($cur_accent_color) && !is_inherit_option($cur_accent_color)) {
                            $menu_styles .= ($item->menu_item_parent == 0 ? "#header_middle_inner #mainmenu li.menu-item-{$item->ID}.current-menu-item > a," : '') . "\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} > a:hover,\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.sfHover > a {\n\t\t\t\t\t\t\t\t\t\tbackground-color: {$cur_accent_color} !important;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} ul {\n\t\t\t\t\t\t\t\t\t\tbackground-color: {$cur_accent_color} !important;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t";
                        }
                        if ($menu_slider && $item->menu_item_parent == 0) {
                            $menu_styles .= "\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over:not(.current-menu-item) > a:hover,\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over.sfHover > a {\n\t\t\t\t\t\t\t\t\t\tbackground-color: transparent !important;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t";
                        }
                        //				}
                    }
                }
                if (!empty($menu_styles)) {
                    addThemeCustomStyle($menu_styles);
                }
            }
        }
    }
    // Main menu height
    $menu_height = (int) get_custom_option('menu_height');
    if ($menu_height > 20) {
        addThemeCustomStyle("\n\t\t\t#mainmenu > li > a {\n\t\t\t\theight: {$menu_height}px !important;\n\t\t\t\tline-height: {$menu_height}px !important;\n\t\t\t}\n\t\t\t#mainmenu > li ul {\n\t\t\t\ttop: {$menu_height}px !important;\n\t\t\t}\n\t\t\t#header_middle {\n\t\t\t\tmin-height: {$menu_height}px !important;\n\t\t\t}\n\t\t");
    }
    // Submenu width
    $menu_width = (int) get_custom_option('menu_width');
    if ($menu_width > 50) {
        addThemeCustomStyle("\n\t\t\t#mainmenu > li ul {\n\t\t\t\twidth: {$menu_width}px;\n\t\t\t}\n\t\t\t#mainmenu > li ul li ul {\n\t\t\t\tleft: " . ($menu_width + 1) . "px;\n\t\t\t}\n\t\t\t#mainmenu > li:nth-child(n+6) ul li ul {\n\t\t\t\tleft: -" . ($menu_width + 1) . "px;\n\t\t\t}\n\t\t");
    }
    if (!empty($theme_color)) {
        addThemeCustomStyle('
			#sidebar_main .popular_and_commented_tabs .tab_content:not(.style_post_format) .post_item .post_title a:hover, 
			.wp-calendar thead th.prevMonth a:hover,
			.wp-calendar thead th.nextMonth a:hover,
			.wp-calendar tbody td.dayWithPost a:hover,
			.widget_twitter .theme_text a,
			.top_news_section .top_news_term a:hover,
			a:hover,
			.trex_accent_color,
			.post_info .post_title a:hover,
			.link_text_wrap a,
			.sc_quote_icon,
			article.format-link > .icon,
			blockquote.sc_quote,
			article.format-aside > .icon,
			article.format-chat > .icon,
			article.format-status > .icon,
			#nav_pages ul li:hover a,
			#nav_pages ul li:hover span,
			#nav_pages ul li.pager_current span,
			#nav_pages .pager_prev a:hover,
			#nav_pages .pager_next a:hover,
			.isotopeFiltr ul li a:hover,
			section.author .user_links ul li span:hover,
			.comment_content .review .label i,
			.popularFiltr ul li.ui-state-active a span,
			.prev_next_posts .prev_post_icon,
			.prev_next_posts .next_post_icon,
			.prev_next_posts .prev_post_link a:hover,
			.prev_next_posts .next_post_link a:hover,
			.link_pages a:hover,
			.itemscope .post_tags a:hover,
			.article_services section.comments li.comment .comment_header .comment_reply a,
			.swpRightPos .sc_tabs .tabsMenuHead li.ui-tabs-active a,
			.swpRightPos .sc_tabs .tabsMenuHead li a:hover,
			.swpRightPos .addBookmark:hover i,
			.swpRightPos .listBookmarks li:hover a,
			#panelmenu li a:hover,
			.popular_and_commented_tabs ul.tabs li a:hover,
			.popular_and_commented_tabs .tab_content .post_item a:hover,
			.popular_and_commented_tabs .tab_content .post_item i.format-icon.hover:before,
			.footerWidget .popular_and_commented_tabs .tab_content h5.post_title a:hover,
			#sidebar_main .widget ul li a:hover,
			.sc_accordion.sc_accordion_style_1 .sc_accordion_item h4.sc_accordion_title i.icon,
			.sc_dropcaps .sc_dropcap,
			.sc_tooltip_parent,
			.sc_skills.sc_skills_type_counter .sc_skills_item_progress,
			.sc_title_icon,
			.sc_title_bg.sc_title_without_bg,
			.sc_icon,
			.sc_tabs ul.sc_tabs_titles li a .icon,
			.slider_wrap .sc_slider_swiper + .flex-control-nav ul li.current .post_icon,
			.sc_testimonials .flex-direction-nav li a,
			.sc_testimonials.sc_testimonials_style_2 .flex-direction-nav li a:hover,
			.sc_blogger .sc_blogger_item .sc_blogger_title a:hover,
			.sc_blogger.style_list .sc_blogger_item > .icon,
			.sc_blogger.style_carousel .sc_blogger_item .post_links a:hover,
			.sc_blogger.style_carousel .prev_slide:hover,
			.sc_blogger.style_carousel .next_slide:hover,
			.sc_review_panel .sc_review_title,
			.sc_team .sc_team_item .sc_team_item_position,
			.sc_list.sc_list_style_ol li .sc_list_num,
			.sc_list.sc_list_style_ol_filled li .sc_list_num,
			.sc_list.sc_list_style_iconed li:before {
				color: ' . $theme_color . ';
			}
			#nav_pages .pager_prev a:hover,
			#nav_pages .pager_next a:hover,
			.isotopeFiltr ul li.active a,
			.pagination_viewmore .view_more_button:hover,
			.popular_and_commented_tabs ul.tabs li.ui-tabs-active a,
			.link_pages a:hover,
			.popular_and_commented_tabs ul.tabs li a:hover,
			.wp-calendar thead th.prevMonth a:hover,
			.wp-calendar thead th.nextMonth a:hover,
			.wp-calendar tbody td.dayWithPost,
			.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
			.sc_dropcaps.sc_dropcaps_style_2 .sc_dropcap,
			.sc_dropcaps .sc_dropcap,
			.sc_tooltip_parent,
			.sc_blogger .sc_blogger_block_link:hover,
			.sc_blogger.style_carousel .prev_slide:hover,
			input[type="submit"]:hover,
			.sc_blogger.style_carousel .next_slide:hover {
				border-color: ' . $theme_color . ';
			}
			article.format-aside > .article_wrap,
			.isotopeFiltr ul li.active a,
			section.author .user_links span.tooltip,
			.vote_criterias li a:hover:before,
			.vote_criterias li a:active:before,
			.link_pages .pages_popup .popup_inner,
			.popular_and_commented_tabs ul.tabs li.ui-tabs-active a,
			#sidebar_main .widget.widget_recent_entries ul li a:before,
			.widget.widget_flickr .flickr_images a,
			.widget_contact_social .tooltip,
			.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
			.sc_dropcaps.sc_dropcaps_style_2 .sc_dropcap,
			.sc_skills.sc_skills_type_bar .sc_skills_item .sc_skills_item_progress,
			.sc_skills.sc_skills_type_bar .sc_skills_item .sc_skills_item_progress .progress_inner,
			.sc_slider_swiper .progress,
			.sc_testimonials .flex-direction-nav li a:hover,
			.sc_blogger_item .thumb a,
			.sc_blogger_item .thumb a .hover_plus,
			.sc_blogger.style_accordion .sc_blogger_item .sc_blogger_title a:hover,
			.sc_blogger.style_date .sc_blogger_item .post_date_info .month,
			.sc_blogger.style_carousel .sc_blogger_item .overlay_mask,
			.sc_blogger.style_carousel .swiper_scrollbar .swiper-scrollbar-drag,
			.sc_button,
			.sc_blogger .sc_blogger_block_link:hover,
			.sc_list.sc_list_style_ul li:before,
			input[type="submit"]:hover,
			a:hover .sc_title_icon,
			.sc_list.sc_list_style_ol_filled li .sc_list_num {
				background: ' . $theme_color . ';
			}
		');
    }
    // Custom css from theme options
    $css = get_custom_option('custom_css');
    $section1_bg = get_custom_option('section_1_bg');
    $section2_bg = get_custom_option('section_2_bg');
    $section1_font = get_custom_option('section_1_font');
    $section2_font = get_custom_option('section_2_font');
    $section2_top_margin = get_custom_option('section2_margin_top');
    $section2_bottom_margin = get_custom_option('section2_margin_bottom');
    $css .= !empty($section1_font) ? '.section_2 { color: ' . $section2_font . '}' : '';
    $css .= !empty($section1_font) ? '.section_1,#topmenu li a, header .section_1 .login_loguout_link { color: ' . $section1_font . '}' : '';
    $css .= !empty($section1_bg) ? 'header .section_1 { background: ' . $section1_bg . '}' : '';
    $sect2_style = '.section_2 {';
    $sect2_style .= !empty($section2_bg) ? ' background: ' . $section2_bg . ';' : '';
    $sect2_style .= !empty($section2_top_margin) ? ' padding-top: ' . $section2_top_margin . 'px; ' : '';
    $sect2_style .= !empty($section2_bottom_margin) ? ' padding-bottom: ' . $section2_bottom_margin . 'px; ' : '';
    $sect2_style .= '}';
    $css .= !empty($sect2_style) ? $sect2_style : '';
    $constructId = getTemplatePageId('under-construction');
    if (!empty($constructId) && get_the_ID() == $constructId) {
        $construct_thumb = wp_get_attachment_url(get_post_thumbnail_id($constructId));
        $css .= !empty($construct_thumb) ? '#page { background-image: url( ' . $construct_thumb . ' ) }' : '';
    }
    if (!empty($css)) {
        addThemeCustomStyle($css);
    }
    return getThemeCustomStyles();
}
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $title_tabs = array(apply_filters('widget_title', isset($instance['title_latest']) ? $instance['title_latest'] : ''), apply_filters('widget_title', isset($instance['title_popular']) ? $instance['title_popular'] : ''), apply_filters('widget_title', isset($instance['title_commented']) ? $instance['title_commented'] : ''));
        $title_tabs = array_filter($title_tabs);
        $title_length = isset($instance['title_length']) ? (int) $instance['title_length'] : 0;
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_info = isset($instance['show_info']) ? $instance['show_info'] : 0;
        $show_rating = isset($instance['show_rating']) ? (int) $instance['show_rating'] : 0;
        $show_cats = isset($instance['show_cats']) ? (int) $instance['show_cats'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $post_thumb = isset($instance['post_thumb']) ? $instance['post_thumb'] : 'hide';
        $output = $tabs = '';
        $titles_str = implode('', $title_tabs);
        for ($i = 0; $i < 3; $i++) {
            if (!empty($title_tabs[$i]) || $i == 0 && strlen($titles_str) == 0) {
                $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC');
                if ($i == 0) {
                    // Latest
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                } else {
                    if ($i == 1) {
                        // Most popular
                        $args['meta_key'] = 'post_views_count';
                        $args['orderby'] = 'meta_value_num';
                    } else {
                        // Most commented
                        $args['orderby'] = 'comment_count';
                    }
                }
                if ($category > 0) {
                    $args['cat'] = $category;
                }
                $ex = get_theme_option('exclude_cats');
                if (!empty($ex)) {
                    $args['category__not_in'] = explode(',', $ex);
                }
                query_posts($args);
                /* Loop posts */
                if (have_posts()) {
                    $abc_range = range('a', 'z');
                    $abc_shuffle = str_shuffle(implode('', $abc_range));
                    $unikey = substr($abc_shuffle, 10);
                    if (count($title_tabs) > 1) {
                        $tabs .= '<li><a href="#widget_popular_' . $i . '_' . $unikey . '" class="theme_button"><span>' . $title_tabs[$i] . '</span></a></li>';
                    }
                    $output .= '
						<div class="tab_content style_' . $post_thumb . '" id="widget_popular_' . $i . '_' . $unikey . '">
					';
                    $post_number = 0;
                    while (have_posts()) {
                        the_post();
                        $post_number++;
                        $post_id = get_the_ID();
                        $post_date = getDateOrDifference(get_the_date('Y-m-d H:i:s'));
                        $post_title = $post->post_title;
                        $post_title = !empty($title_length) ? getShortString($post_title, $title_length, '...') : $post_title;
                        $post_link = get_permalink();
                        $post_custom = get_post_custom($post_id);
                        $post_comments = wp_count_comments($post_id);
                        $post_comments_link = '<a href="' . $post_link . '#comments"><i class="icon-comment-1"></i>' . $post_comments->approved . '</a>';
                        $post_votes = !empty($post_custom['post_votes_data']) ? $post_custom['post_votes_data'] : '';
                        $votes_data = !empty($post_votes[0]) ? unserialize($post_votes[0]) : '';
                        $crit_points = !empty($votes_data['criterias_points']) ? $votes_data['criterias_points'] : '';
                        $total_votes = !empty($votes_data['total_votes']) ? $votes_data['total_votes'] : '';
                        $votes_sum = !empty($crit_points) ? array_sum($crit_points) : '';
                        $votes_avg = !empty($votes_sum) && !empty($total_votes) ? $votes_sum / $total_votes : '';
                        $votes_avg = !empty($votes_avg) ? number_format($votes_avg, 0) : '';
                        $cust_opt = !empty($post_custom['post_custom_options'][0]) ? unserialize($post_custom['post_custom_options'][0]) : '';
                        $author_review = !empty($cust_opt['reviews_marks']) ? explode(',', $cust_opt['reviews_marks']) : '';
                        $author_avg = count($author_review) > 0 ? number_format(array_sum($author_review) / count($author_review), 0) : 0;
                        $post_format = get_post_format($post_id);
                        $post_format = $post_format == false ? 'standard' : $post_format;
                        $format_icon = getPostFormatIcon($post_format);
                        $avg_arr = array();
                        $avg_arr[] = !empty($author_avg) ? $author_avg : '';
                        $avg_arr[] = !empty($votes_avg) ? $votes_avg : '';
                        $avg_arr = array_filter($avg_arr);
                        $total_avg = count($avg_arr) > 0 ? array_sum($avg_arr) / count($avg_arr) : '';
                        $post_categories_links = '';
                        if ($show_cats) {
                            $post_categories_list = getCategoriesByPostId($post_id);
                            $ex_cats = explode(',', get_theme_option('exclude_cats'));
                            $cat_count = count($post_categories_list);
                            for ($c = 0; $c < $cat_count; $c++) {
                                if (in_array($post_categories_list[$c]['term_id'], $ex_cats)) {
                                    continue;
                                }
                                $post_categories_ids[] = $post_categories_list[$c]['term_id'];
                                $category_color = get_category_inherited_property($post_categories_list[$c]['term_id'], 'category_color');
                                if (empty($category_color)) {
                                    $category_color = get_theme_option('category_color');
                                }
                                $post_categories_links .= '<a class="cat_link" href="' . $post_categories_list[$c]['link'] . '"' . (!empty($category_color) ? ' style="background:' . $category_color . '"' : '') . '	>' . $post_categories_list[$c]['name'] . '</a>';
                                $post_categories_links .= count($post_categories_list) > 1 && $c + 1 == $cat_count ? '<br>' : '';
                            }
                        }
                        $review = '';
                        if (!empty($total_avg) && $show_rating) {
                            $review = get_review_rating('5stars', min($total_avg, 100), 100, '#f2c574');
                        }
                        $post_info = '';
                        $post_info .= !empty($show_info) ? '<div class="widget_popular_post_info">' . $post_categories_links . (!empty($review) ? $review : '') . '<span class="post_date"><i class="icon-clock-1"></i>' . $post_date . '</span>' . '<span class="divider">|</span>' . $post_comments_link . '</div>' : '';
                        $output .= '
							<div class="post_item' . ($post_number == 1 ? ' first' : '') . (!empty($post_thumb) ? ' thumb_style_' . $post_thumb : '') . '">
						';
                        $thumb_size = $post_thumb == 'large_thumb' ? 100 : 64;
                        if (in_array($post_thumb, array('large_thumb', 'default_thumb'))) {
                            $post_thumbnail = getResizedImageTag($post_id, $thumb_size, $thumb_size);
                            if ($post_thumbnail) {
                                $output .= '
										<div class="post_thumb image_wrapper">' . $post_thumbnail . '</div>
								';
                            }
                        } else {
                            if ($post_thumb == 'post_format') {
                                $output .= '<i class="' . $format_icon . ' format-icon"></i>';
                            }
                        }
                        $output .= '
										<div class="post_wrapper">
											<h5 class="post_title theme_title"><a href="' . $post_link . '">' . $post_title . '</a></h5>
						';
                        $output .= $post_info . '
								</div>
							</div>
						';
                        if ($post_number >= $number) {
                            break;
                        }
                    }
                    $output .= '
						</div>';
                }
            }
        }
        /* Restore main wp_query and current post data in the global var $post */
        wp_reset_query();
        wp_reset_postdata();
        if (!empty($output)) {
            wp_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true);
            /* Before widget (defined by themes). */
            echo $before_widget;
            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo '
				<div class="popular_and_commented_tabs' . ($show_info || $show_rating ? '' : ' flat_list') . '">
					' . (strlen($titles_str) != 0 && count($title_tabs) > 1 ? '<ul class="tabs">' . $tabs . '</ul>' : '') . '
					' . $output . '
					<script type="text/javascript">
						jQuery(document).ready(function() {
							jQuery(\'.popular_and_commented_tabs\').tabs();
						});
					</script>
				</div>
			';
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }
Ejemplo n.º 10
0
 }
 $maxLevel = max(5, (int) get_custom_option('reviews_max_level'));
 $allowUserReviews = (!$reviews_first_author || !$reviews_second_hide) && (!isset($_COOKIE['reviews_vote']) || themerex_strpos($_COOKIE['reviews_vote'], ',' . $post_data['post_id'] . ',') === false) && (get_theme_option('reviews_can_vote') == 'all' || is_user_logged_in());
 $THEMEREX_REVIEWS_RATING = '<div class="reviewBlock' . ($use_tabs ? ' sc_tabs sc_tabs_style_1 sc_tabs_effects' : '') . '">';
 $output = $marks = $users = '';
 if ($use_tabs) {
     $author_tab = '<li><a href="#author-tabs">' . __('Author', 'themerex') . '</a></li>';
     $users_tab = '<li><a href="#users-tabs">' . __('Users', 'themerex') . '</a></li>';
     $output .= '<ul class="sc_tabs_titles">' . ($reviews_first_author ? $author_tab . $users_tab : $users_tab . $author_tab) . '</ul>';
 }
 // Criterias list
 $field = array("options" => get_theme_option('reviews_criterias'));
 if (count($post_data['post_categories_list']) > 0) {
     foreach ($post_data['post_categories_list'] as $cat) {
         $id = (int) $cat['term_id'];
         $prop = get_category_inherited_property($id, 'reviews_criterias');
         if (!empty($prop) && !is_inherit_option($prop)) {
             $field['options'] = $prop;
             break;
         }
     }
 }
 // Author marks
 $output .= '<div class="sc_tabs_array">';
 if ($reviews_first_author || !$reviews_second_hide) {
     $field["id"] = "reviews_marks_author";
     $field["descr"] = strip_tags($post_data['post_excerpt']);
     $field["accept"] = false;
     $marks = marksToDisplay(marksPrepare(get_custom_option('reviews_marks'), count($field['options'])));
     $output .= '<div class="reviewTab" id="author-tabs">' . getReviewsMarkup($field, $marks, false, false, $reviews_first_author) . '</div>';
 }
<?php

$count = get_custom_option('top_news_count');
$cats = get_custom_option('top_news_cats') != '' ? explode(',', get_custom_option('top_news_cats')) : '';
$mult = get_custom_option('retina_ready');
$top_news_title = get_custom_option('top_news_title');
$term_output = '';
if (!empty($cats)) {
    $term_output .= '<div class="top_news_section">';
    $term_output .= '<h3 class="top_news_title">' . $top_news_title . '</h3>';
    foreach ($cats as $cat) {
        $category_color = get_category_inherited_property($cat, 'category_color');
        $category_color = empty($category_color) ? get_theme_option('category_color') : $category_color;
        $cat_term = get_term($cat, 'category');
        $term_name = $cat_term->name;
        $term_output .= '<div class="top_news_term">';
        $term_output .= '<span class="term_name"' . (!empty($category_color) ? ' style="color:' . $category_color . '"' : '') . '>' . $term_name . '</span>';
        $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => 'DESC', 'cat' => $cat);
        query_posts($args);
        /* Loop posts */
        while (have_posts()) {
            the_post();
            $post_id = get_the_ID();
            $post_link = get_permalink($post_id);
            $post_thumb = getResizedImageTag($post_id, 152 * $mult, 152 * $mult);
            $post_title = get_the_title($post_id);
            $term_output .= '<div class="post_' . $post_id . ' top_news_post"><a href="' . $post_link . '">' . $post_thumb . '<span class="top_news_post_title">' . $post_title . '</span></a></div>';
        }
        $term_output .= '</div>';
    }
    /* Restore main wp_query and current post data in the global var $post */