Beispiel #1
0
<?php

/**
 * The Header for our theme.
 *
 * @package puzzles
 */
// AJAX Queries settings
global $THEMEREX_ajax_nonce, $THEMEREX_ajax_url;
$THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce');
$THEMEREX_ajax_url = admin_url('admin-ajax.php');
// Theme custom settings from current post and category
global $THEMEREX_cat_options, $THEMEREX_post_options, $THEMEREX_custom_options, $THEMEREX_shop_options, $wp_query;
// Current post & category custom options
$THEMEREX_post_options = $THEMEREX_cat_options = $THEMEREX_custom_options = $THEMEREX_shop_options = array();
if (is_woocommerce_page() && ($page_id = get_option('woocommerce_shop_page_id')) > 0) {
    $THEMEREX_shop_options = get_post_meta($page_id, 'post_custom_options', true);
}
if (is_category()) {
    $cat = (int) get_query_var('cat');
    if (empty($cat)) {
        $cat = get_query_var('category_name');
    }
    $THEMEREX_cat_options = getCategoryInheritedProperties($cat);
} else {
    if ((is_day() || is_month() || is_year()) && ($page_id = getTemplatePageId('archive')) > 0) {
        $THEMEREX_post_options = get_post_meta($page_id, 'post_custom_options', true);
    } else {
        if (is_search() && ($page_id = getTemplatePageId('search')) > 0) {
            $THEMEREX_post_options = get_post_meta($page_id, 'post_custom_options', true);
        } else {
Beispiel #2
0
function getBlogType($query = null)
{
    global $wp_query;
    if ($query === null) {
        $query = $wp_query;
    }
    $page = '';
    if (is_woocommerce_page()) {
        if (is_shop()) {
            $page = 'woocommerce_shop';
        } else {
            if (is_product_category()) {
                $page = 'woocommerce_category';
            } else {
                if (is_product_tag()) {
                    $page = 'woocommerce_tag';
                } else {
                    if (is_product()) {
                        $page = 'woocommerce_product';
                    } else {
                        if (is_cart()) {
                            $page = 'woocommerce_cart';
                        } else {
                            if (is_checkout()) {
                                $page = 'woocommerce_checkout';
                            } else {
                                if (is_account_page()) {
                                    $page = 'woocommerce_account';
                                } else {
                                    $page = 'woocommerce';
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        if (isset($query->queried_object) && isset($query->queried_object->post_type) && $query->queried_object->post_type == 'page') {
            $page = get_post_meta($query->queried_object_id, '_wp_page_template', true);
        } else {
            if (isset($query->query_vars['page_id'])) {
                $page = get_post_meta($query->query_vars['page_id'], '_wp_page_template', true);
            } else {
                if (isset($query->queried_object) && isset($query->queried_object->taxonomy)) {
                    $page = $query->queried_object->taxonomy;
                }
            }
        }
    }
    if ($page == 'template-blog.php') {
        // || is_page_template( 'template-blog.php' ) )
        return 'blog';
    } else {
        if (themerex_strpos($page, 'woocommerce') !== false) {
            // WooCommerce
            return $page;
        } else {
            if ($query && $query->is_404()) {
                // || is_404() ) 					// -------------- 404 error page
                return 'error';
            } else {
                if ($query && $query->is_search()) {
                    // || is_search() ) 				// -------------- Search results
                    return 'search';
                } else {
                    if ($query && $query->is_day()) {
                        // || is_day() )					// -------------- Archives daily
                        return 'archives_day';
                    } else {
                        if ($query && $query->is_month()) {
                            // || is_month() ) 				// -------------- Archives monthly
                            return 'archives_month';
                        } else {
                            if ($query && $query->is_year()) {
                                // || is_year() )  				// -------------- Archives year
                                return 'archives_year';
                            } else {
                                if ($query && $query->is_category()) {
                                    // || is_category() )  		// -------------- Category
                                    return 'category';
                                } else {
                                    if ($query && $query->is_tag()) {
                                        // || is_tag() ) 	 				// -------------- Tag posts
                                        return 'tag';
                                    } else {
                                        if ($query && $query->is_author()) {
                                            // || is_author() )				// -------------- Author page
                                            return 'author';
                                        } else {
                                            if ($query && $query->is_attachment()) {
                                                // || is_attachment() )
                                                return 'attachment';
                                            } else {
                                                if ($query && $query->is_single()) {
                                                    // || is_single() )				// -------------- Single post
                                                    return 'single';
                                                } else {
                                                    if ($query && $query->is_page()) {
                                                        // || is_page() )
                                                        return 'page';
                                                    } else {
                                                        // -------------- Home page
                                                        return 'home';
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Beispiel #3
0
 function get_custom_option($name, $defa = null, $post_id = 0, $cat_id = 0)
 {
     $defaults = array('default', 'inherit');
     if ($cat_id > 0) {
         $rez = getCategoryInheritedProperty($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]) && !in_array(themerex_strtolower($custom_options[$name]), $defaults)) {
                 $rez = $custom_options[$name];
             } else {
                 $categories = getCategoriesByPostId($post_id);
                 $tmp = '';
                 for ($cc = 0; $cc < count($categories) && $tmp == ''; $cc++) {
                     $tmp = getCategoryInheritedProperty($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]) && !in_array(themerex_strtolower(is_array($THEMEREX_shop_options[$name]) ? $THEMEREX_shop_options[$name][0] : $THEMEREX_shop_options[$name]), $defaults)) {
                     $rez = is_array($THEMEREX_shop_options[$name]) ? $THEMEREX_shop_options[$name][0] : $THEMEREX_shop_options[$name];
                 }
                 if (!is_single() && isset($THEMEREX_post_options[$name]) && !in_array(themerex_strtolower(is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name]), $defaults)) {
                     $rez = is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name];
                 }
                 if (isset($THEMEREX_cat_options[$name]) && !in_array(themerex_strtolower($THEMEREX_cat_options[$name]), $defaults)) {
                     $rez = $THEMEREX_cat_options[$name];
                 }
                 if (is_single() && isset($THEMEREX_post_options[$name]) && !in_array(themerex_strtolower(is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name]), $defaults)) {
                     $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 (!in_array(themerex_strtolower($tmp), $defaults)) {
                         $rez = $tmp;
                     }
                 }
                 $THEMEREX_custom_options[$name] = $rez;
             }
         }
     }
     return $rez;
 }
<?php

if (get_custom_option('show_user_menu') == 'yes') {
    ?>
<ul class="usermenuList">

	<?php 
    if (function_exists('is_woocommerce') && (is_woocommerce_page() && get_custom_option('show_cart') == 'shop' || get_custom_option('show_cart') == 'always') && !(is_checkout() || is_cart() || defined('WOOCOMMERCE_CHECKOUT') || defined('WOOCOMMERCE_CART'))) {
        ?>
		<li class="usermenuCart">
			<a href="#" class="cart_button"><span><?php 
        if ($THEMEREX_usermenu_show) {
            _e('Cart', 'themerex');
        }
        ?>
</span> <b class="cart_total"><?php 
        echo WC()->cart->get_cart_subtotal();
        ?>
</b></a>
				<ul class="widget_area sidebar_cart sidebar"><li>
					<?php 
        do_action('before_sidebar');
        global $THEMEREX_CURRENT_SIDEBAR;
        $THEMEREX_CURRENT_SIDEBAR = 'cart';
        if (!dynamic_sidebar('sidebar-cart')) {
            the_widget('WC_Widget_Cart', 'title=&hide_if_empty=1');
        }
        ?>
				</li></ul>
		</li>
	<?php 
Beispiel #5
0
function dumpWP_is($query = null)
{
    global $wp_query;
    if (!$query) {
        $query = $wp_query;
    }
    echo "<tt>" . "<br>admin=" . is_admin() . "<br>main_query=" . is_main_query() . "  query=" . $query->is_main_query() . "<br>query->is_posts_page=" . $query->is_posts_page . "<br>home=" . is_home() . "  query=" . $query->is_home() . "<br>fp=" . is_front_page() . "  query=" . $query->is_front_page() . "<br>search=" . is_search() . "  query=" . $query->is_search() . "<br>category=" . is_category() . "  query=" . $query->is_category() . "<br>tag=" . is_tag() . "  query=" . $query->is_tag() . "<br>archive=" . is_archive() . "  query=" . $query->is_archive() . "<br>day=" . is_day() . "  query=" . $query->is_day() . "<br>month=" . is_month() . "  query=" . $query->is_month() . "<br>year=" . is_year() . "  query=" . $query->is_year() . "<br>author=" . is_author() . "  query=" . $query->is_author() . "<br>page=" . is_page() . "  query=" . $query->is_page() . "<br>single=" . is_single() . "  query=" . $query->is_single() . "<br>singular=" . is_singular() . "  query=" . $query->is_singular() . "<br>attachment=" . is_attachment() . "  query=" . $query->is_attachment() . "<br>WooCommerce=" . is_woocommerce_page() . "<br><br />" . "</tt>";
}
Beispiel #6
0
 function ishyoboy_woocommerce_demo_store()
 {
     if (is_woocommerce() || is_woocommerce_page()) {
         woocommerce_demo_store();
     }
 }
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;
}
Beispiel #8
0
 function ishyoboy_shortcode_breadcrumbs($atts, $content = null)
 {
     global $ish_options, $ish_woo_id;
     $sc_atts = shortcode_atts(array('id' => '', 'css_class' => '', 'style' => '', 'tooltip' => '', 'tooltip_color' => '', 'color' => '', 'align' => ''), $atts);
     $return = '';
     $return .= '<div class="list-breadcrumbs';
     $return .= '' != $sc_atts['css_class'] ? ' ' . esc_attr($sc_atts['css_class']) : '';
     $return .= '' != $sc_atts['color'] ? ' ' . esc_attr($sc_atts['color']) : '';
     $return .= 'center' == $sc_atts['align'] ? ' acenter' : '';
     $return .= 'right' == $sc_atts['align'] ? ' aright' : '';
     $return .= 'left' == $sc_atts['align'] ? ' aleft' : '';
     $return .= '' != $sc_atts['tooltip'] && '' != $sc_atts['tooltip_color'] ? ' tooltip-' . esc_attr($sc_atts['tooltip_color']) : '';
     $return .= '"';
     $return .= '' != $sc_atts['id'] ? ' id="' . esc_attr($sc_atts['id']) . '"' : '';
     $return .= '' != $sc_atts['style'] ? ' style="' . esc_attr($sc_atts['style']) . '"' : '';
     $return .= '' != $sc_atts['tooltip'] ? ' data-type="tooltip" title="' . esc_attr($sc_atts['tooltip']) . '"' : '';
     $return .= '>' . "\n";
     if (!is_front_page()) {
         if (function_exists('is_woocommerce')) {
             if (!is_woocommerce() && !is_woocommerce_page()) {
                 //$return .= '<p class="breadcrumb"><span class="breadcrumb_info">You are here:</span> <a href="';
                 $return .= '<p class="breadcrumb"><a href="';
                 $return .= home_url();
                 $return .= '">';
                 $return .= __('Home', 'ishyoboy');
                 $return .= "</a> &gt; ";
             }
         } else {
             //$return .= '<p class="breadcrumb"><span class="breadcrumb_info">You are here:</span> <a href="';
             $return .= '<p class="breadcrumb"><a href="';
             $return .= home_url();
             $return .= '">';
             $return .= __('Home', 'ishyoboy');
             $return .= "</a> &gt; ";
         }
     }
     if ((is_category() || is_single()) && (!function_exists('is_woocommerce_page') || !is_woocommerce() && !is_woocommerce_page())) {
         $post_id = get_the_ID();
         $post_type = get_post_type();
         switch ($post_type) {
             case 'portfolio-post':
                 $terms = get_the_terms($post_id, 'portfolio-category');
                 $term = array_pop($terms);
                 if (isset($ish_options['page_for_custom_post_type_portfolio-post']) && '-1' != $ish_options['page_for_custom_post_type_portfolio-post']) {
                     $portfolio_page = get_page($ish_options['page_for_custom_post_type_portfolio-post']);
                     $separator = " &gt; ";
                     $return .= '<a href="' . get_page_link($ish_options['page_for_custom_post_type_portfolio-post']) . '" title="' . esc_attr(sprintf(__("View all posts in %s", 'ishyoboy'), $portfolio_page->post_title)) . '">' . $portfolio_page->post_title . '</a>' . $separator;
                 }
                 $return .= get_term_parents($term->term_id, 'portfolio-category', TRUE, ' &gt; ', FALSE);
                 break;
             default:
                 $category = get_the_category();
                 if (!empty($category)) {
                     $ID = $category[0]->cat_ID;
                     $return .= get_category_parents($ID, TRUE, ' &gt; ', FALSE);
                 }
         }
     } else {
         if (function_exists('is_woocommerce_page') && (is_woocommerce() || is_woocommerce_page())) {
             ob_start();
             woocommerce_breadcrumb(array('delimiter' => ' &gt; ', 'wrap_before' => '<p class="breadcrumb">', 'wrap_after' => '</p>', 'before' => '', 'after' => '', 'home' => _x('Home', 'breadcrumb', 'woocommerce')));
             $return .= ob_get_contents();
             ob_end_clean();
             ob_end_flush();
         } else {
             if (is_tax()) {
                 if (is_tax('portfolio-category')) {
                     $current_term = get_queried_object();
                     if (!empty($current_term)) {
                         //var_dump($current_term);
                         if (isset($ish_options['page_for_custom_post_type_portfolio-post']) && '-1' != $ish_options['page_for_custom_post_type_portfolio-post']) {
                             $portfolio_page = get_page($ish_options['page_for_custom_post_type_portfolio-post']);
                             $separator = " &gt; ";
                             $return .= '<a href="' . get_page_link($ish_options['page_for_custom_post_type_portfolio-post']) . '" title="' . esc_attr(sprintf(__("View all posts in %s", 'ishyoboy'), $portfolio_page->post_title)) . '">' . $portfolio_page->post_title . '</a>' . $separator;
                         }
                         if ($current_term->parent != 0) {
                             $return .= get_term_parents($current_term->parent, 'portfolio-category', TRUE, ' &gt; ', FALSE);
                         }
                         $return .= $current_term->name;
                     }
                 }
             } else {
                 if (is_page()) {
                     global $post;
                     if ($post->post_parent != 0) {
                         $return .= get_page_parents($post->post_parent, TRUE, ' &gt; ', FALSE);
                     }
                 }
             }
         }
     }
     if (!function_exists('is_woocommerce_page') || !is_woocommerce_page()) {
         if (is_single() || is_page()) {
             $return .= get_the_title();
         }
         if (is_tag()) {
             $return .= "Tag: " . single_tag_title('', FALSE);
         }
         if (is_404()) {
             $return .= "404 - Page not Found";
         }
         if (is_search()) {
             $return .= "Search";
         }
         if (is_year()) {
             $return .= get_the_time('Y');
         }
     }
     $return .= '</div>';
     return $return;
 }
Beispiel #9
0
 function ishyoboy_get_sidebar($post_id = null)
 {
     global $ish_options;
     if ($post_id) {
         $id = $post_id;
     } else {
         $id = is_tax() || is_search() || is_archive() || is_category() || is_tag() ? null : ish_get_the_ID();
     }
     if (is_home()) {
         $meta = get_post_meta(get_option('page_for_posts'));
         $sidebar_position = isset($meta['ishyometa_ishyoboy_sidebar_position']) ? $meta['ishyometa_ishyoboy_sidebar_position'][0] : '';
     } elseif (null != $id) {
         $sidebar_position = IshYoMetaBox::get('ishyoboy_sidebar_position', true, $id);
     } else {
         if (is_tax() || is_search() || is_archive() || is_category() || is_tag()) {
             $sidebar_position = '';
         } else {
             $sidebar_position = IshYoMetaBox::get('ishyoboy_sidebar_position');
         }
     }
     if ('' != $sidebar_position) {
         // Local settings exist
         if (is_home()) {
             $sidebar = isset($meta['ishyometa_ishyoboy_sidebar']) ? $meta['ishyometa_ishyoboy_sidebar'][0] : '';
         } else {
             $sidebar = IshYoMetaBox::get('ishyoboy_sidebar', true, $id);
         }
     } else {
         // Use global settings
         if ($id == $ish_options['page_for_custom_post_type_portfolio-post'] || is_singular('portfolio-post') || is_tax('portfolio-category')) {
             // PORTFOLIO OVERVIEW
             //echo '<h1>DEFAULT: PORTFOLIO OVERVIEW</h1>';
             if (isset($ish_options['show_portfolio_sidebar']) && '1' == $ish_options['show_portfolio_sidebar']) {
                 // Portfolio sidebar set
                 $sidebar = $ish_options['portfolio_sidebar'];
             } else {
                 // Portfolio sidebar not set
                 $sidebar = '';
             }
         } else {
             if (function_exists('is_woocommerce') && (is_woocommerce() || is_woocommerce_page())) {
                 if (isset($ish_options['show_woocommerce_sidebar']) && '1' == $ish_options['show_woocommerce_sidebar']) {
                     $sidebar = $ish_options['woocommerce_sidebar'];
                 } else {
                     $sidebar = '';
                 }
             } else {
                 if (is_home() || is_singular('post') || is_category() || is_tag() || is_archive()) {
                     // BLOG OVERVIEW
                     //echo '<h1>DEFAULT: BLOG OVERVIEW</h1>';
                     if (isset($ish_options['show_blog_sidebar']) && '1' == $ish_options['show_blog_sidebar']) {
                         $sidebar = $ish_options['blog_sidebar'];
                     } else {
                         $sidebar = '';
                     }
                 } else {
                     // REGULAR PAGE
                     //echo '<h1>DEFAULT: REGULAR PAGE</h1>';
                     if (isset($ish_options['show_page_sidebar']) && '1' == $ish_options['show_page_sidebar']) {
                         $sidebar = $ish_options['page_sidebar'];
                     } else {
                         $sidebar = '';
                     }
                 }
             }
         }
     }
     return $sidebar;
 }
global $THEMEREX_usermenu, $THEMEREX_usermenu_show;
if (empty($THEMEREX_usermenu) || !$THEMEREX_usermenu_show) {
    // todo: scrollbar
    themerex_enqueue_style('swiperslider-style', themerex_get_file_url('/js/swiper/idangerous.swiper.css'), array(), null);
    themerex_enqueue_style('swiperslider-scrollbar-style', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar.css'), array(), null);
    themerex_enqueue_script('swiperslider', themerex_get_file_url('/js/swiper/idangerous.swiper-2.7.js'), array('jquery'), null, true);
    themerex_enqueue_script('swiperslider-scrollbar', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar-2.4.js'), array('jquery'), null, true);
    ?>
	<ul id="usermenu" class="usermenu_list">
    <?php 
}
?>

<?php 
if ($THEMEREX_usermenu_show && is_woocommerce_page() && get_custom_option('show_currency') == 'yes') {
    ?>
	<li class="usermenu_currency">
		<a href="#">$</a>
		<ul>
			<li><a href="#"><b>&#36;</b> <?php 
    _e('Dollar', 'themerex');
    ?>
</a></li>
			<li><a href="#"><b>&euro;</b> <?php 
    _e('Euro', 'themerex');
    ?>
</a></li>
			<li><a href="#"><b>&pound;</b> <?php 
    _e('Pounds', 'themerex');
    ?>