Esempio n. 1
0
 public function fix_nav_menu_css_class($classes, $item)
 {
     $blog_page_id = (int) g1_get_theme_option('post_type_post', 'page_for_posts');
     $post_type = get_post_type();
     if (in_array($post_type, array('forum', 'topic', 'reply'))) {
         // Remove current_page_parent class from the blog index page
         if ($blog_page_id == $item->object_id && 'page' == $item->object) {
             $classes = array_diff($classes, array('current_page_parent'));
         }
     }
     return $classes;
 }
Esempio n. 2
0
 /**
  * Fixes CSS classes in custom navigation menus.
  *
  * @param array $classes
  * @param object $item
  */
 public function fix_nav_menu_css_class($classes, $item)
 {
     if ($this->get_post_type() == get_post_type()) {
         // Remove current_page_parent class from the blog index page
         if (get_option('page_for_posts') == $item->object_id && 'page' == $item->object) {
             $classes = array_diff($classes, array('current_page_parent'));
         }
         $index = absint(g1_get_theme_option('post_type_' . $this->get_post_type(), 'page_for_posts'));
         // WPML fallback
         if (function_exists('icl_object_id')) {
             $index = absint(icl_object_id($index, 'page', true));
         }
         // Add current_page_parent class to the index page
         if ($index == $item->object_id && 'page' == $item->object) {
             $classes[] = 'current_page_parent';
         }
     }
     return $classes;
 }
Esempio n. 3
0
 /**
  * Replace the "show_on_front" option with the custom solution.
  *
  * Determines the "show_on_front" option based on the "post_index_page" and
  * the "page_home_page" theme options.
  *
  * @param mixed $value
  * @return mixed
  */
 public function pre_option_show_on_front($value)
 {
     $page_on_front = absint(g1_get_theme_option('post_type_page', 'home_page'));
     $page_for_posts = absint(g1_get_theme_option('post_type_post', 'page_for_posts'));
     if (!$page_on_front) {
         return 'posts';
     }
     if ($page_on_front === $page_for_posts) {
         return 'posts';
     }
     return 'page';
 }
Esempio n. 4
0
 * that was distributed with this source code.
 *
 * @package G1_Framework
 * @subpackage G1_Theme03
 * @since G1_Theme03 1.0.0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
$post_type = get_post_type();
$href = '';
$text = '';
if ('post' === $post_type) {
    $index_page = intval(g1_get_theme_option('post_type_post', 'page_for_posts'));
    $home_page = intval(g1_get_theme_option('post_type_page', 'home_page'));
    // WPML fallback
    if (function_exists('icl_object_id')) {
        $index_page = absint(icl_object_id($index_page, 'page', true));
        $home_page = absint(icl_object_id($home_page, 'page', true));
    }
    if ($index_page && $index_page !== $home_page) {
        $href = get_permalink($index_page);
    } else {
        $href = home_url();
    }
} else {
    $href = get_post_type_archive_link($post_type);
}
$post_type_obj = get_post_type_object($post_type);
$text = $post_type_obj->labels->all_items;
Esempio n. 5
0
    _ex(' ', 'searchbox switch label', 'g1_theme');
    ?>
</strong>
                    </a>
                    <?php 
    get_search_form();
    ?>
                </div>
                <?php 
}
?>

                <?php 
// Render feeds
if (shortcode_exists('g1_social_icons')) {
    $g1_social_icons_size = g1_get_theme_option('ta_preheader', 'g1_social_icons');
    if (is_numeric($g1_social_icons_size)) {
        $g1_social_icons_size = intval($g1_social_icons_size);
        echo do_shortcode('[g1_social_icons template="list-horizontal" size="' . $g1_social_icons_size . '" hide="label, caption"]');
    }
}
?>
            </div>
            <!-- END #g1-preheader-bar -->

            <?php 
if (count($g1_rows)) {
    ?>
            <!-- BEGIN #g1-preheader-widget-area -->
            <div id="g1-preheader-widget-area">
                <?php 
Esempio n. 6
0
            <?php 
/* Executes a custom hook.
 * If you want to add some content after the g1-footer-area,
 * hook into 'g1_footer_end' action.
 */
do_action('g1_footer_end');
?>

        <?php 
get_template_part('template-parts/g1_background', 'footer');
?>
	</footer>
	<!-- END #g1-footer -->

    <?php 
if ('none' !== g1_get_theme_option('general', 'scroll_to_top', 'standard')) {
    ?>
        <a href="#page" id="g1-back-to-top"><?php 
    _e('Back to Top', 'g1_theme');
    ?>
</a>
    <?php 
}
?>
	
	<?php 
/* Executes a custom hook.
 * If you want to add some content after the g1-footer,
 * hook into 'g1_footer_after' action.
 */
do_action('g1_footer_after');
Esempio n. 7
0
<?php

/**
 * For the full license information, please view the Licensing folder
 * that was distributed with this source code.
 *
 * @package G1_Framework
 * @subpackage G1_Theme03
 * @since G1_Theme03 1.0.0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
$g1_bbpress_template = g1_get_theme_option('bbpress', 'forum_template', 'sidebar_right');
// Add proper body classes
switch ($g1_bbpress_template) {
    case 'sidebar_right':
        add_filter('body_class', array(G1_Theme(), 'secondary_after_body_class'));
        add_filter('body_class', array(G1_Theme(), 'secondary_wide_body_class'));
        break;
    case 'sidebar_left':
        add_filter('body_class', array(G1_Theme(), 'secondary_before_body_class'));
        add_filter('body_class', array(G1_Theme(), 'secondary_wide_body_class'));
        break;
    default:
        add_filter('body_class', array(G1_Theme(), 'secondary_none_body_class'));
        break;
}
get_header('bbpress');
?>
Esempio n. 8
0
if (is_home()) {
    $title = __('Blog', 'g1_theme');
    $page_id = (int) get_option('page_for_posts');
    if ($page_id) {
        // WPML fallback
        if (function_exists('icl_object_id')) {
            $page_id = icl_object_id($page_id, 'page', true);
        }
        if ($page_id) {
            $title = get_the_title($page_id);
            $subtitle = wp_kses_data(get_post_meta($page_id, '_g1_subtitle', true));
        }
    }
} elseif (is_post_type_archive()) {
    $title = post_type_archive_title('', false);
    $page_id = g1_get_theme_option('post_type_' . get_query_var('post_type'), 'page_for_posts');
    if ($page_id) {
        // WPML fallback
        if (function_exists('icl_object_id')) {
            $page_id = icl_object_id($page_id, 'page', true);
        }
        if ($page_id) {
            $subtitle = wp_kses_data(get_post_meta($page_id, '_g1_subtitle', true));
        }
    }
} elseif (is_category()) {
    $title = '<span>' . single_term_title('', false) . '</span>';
    $subtitle = strip_tags(term_description());
} elseif (is_tag()) {
    $title = sprintf(__('Tag Archives: %s', 'g1_theme'), '<span>' . single_term_title('', false) . '</span>');
    $subtitle = strip_tags(term_description());
Esempio n. 9
0
 public function get_global_value($post_type)
 {
     $template = null;
     if (post_type_supports($post_type, $this->global_feature)) {
         $template = g1_get_theme_option('post_type_' . $post_type, 'single_template');
     }
     return $template;
 }
Esempio n. 10
0
 public function get_global_value($key, $name, $type = 'post_type')
 {
     $val = null;
     $val = g1_get_theme_option($this->get_global_archive_id_base($name, $type), $key);
     return $val;
 }
Esempio n. 11
0
 public function render_global_gmap()
 {
     $latitude = g1_get_theme_option('map', 'latitude', '');
     $longitude = g1_get_theme_option('map', 'longitude', '');
     if (strlen($latitude) === 0 || strlen($longitude) === 0) {
         return;
     }
     $color = g1_get_theme_option('map', 'color', '');
     $map_type = g1_get_theme_option('map', 'type', 'roadmap');
     $invert_lightness = abs(g1_get_theme_option('map', 'invert_lightness', 0));
     $zoom = g1_get_theme_option('map', 'zoom', 15);
     $marker = g1_get_theme_option('map', 'marker', 'none');
     $marker_icon = g1_get_theme_option('map', 'marker_icon', '');
     $marker_content = g1_get_theme_option('map', 'marker_content', '');
     echo do_shortcode(sprintf('[gmap color="%s" map_type="%s" invert_lightness="%s" latitude="%s" longitude="%s" zoom="%s" marker="%s" marker_icon="%s" height="%s"]%s[/gmap]', esc_attr($color), $map_type, $invert_lightness ? 1 : 0, esc_attr($latitude), esc_attr($longitude), esc_attr($zoom), esc_attr($marker), esc_attr($marker_icon), '680px', $marker_content));
 }
Esempio n. 12
0
 * hook into 'g1_prefooter_before' action.
 */
do_action('g1_prefooter_before');
?>
<!-- BEGIN #g1-prefooter -->
<aside id="g1-prefooter" class="g1-prefooter">
    <?php 
/* Executes a custom hook.
 * If you want to add some content before the g1-prefooter-widget-area,
 * hook into 'g1_prefooter_begin' action.
 */
do_action('g1_prefooter_begin');
?>
        <?php 
$g1_mapping = array('1/1' => 'g1-max', '1/2' => 'g1-one-half', '1/3' => 'g1-one-third', '1/4' => 'g1-one-fourth', '3/4' => 'g1-three-fourths');
$g1_composition = g1_get_theme_option('ta_prefooter', 'composition', '1/3+1/3+1/3');
$g1_composition = 'none' === $g1_composition ? '' : $g1_composition;
$g1_rows = strlen($g1_composition) ? explode('_', $g1_composition) : array();
$g1_index = 1;
?>

        <?php 
if (count($g1_rows)) {
    ?>
        <!-- BEGIN #g1-prefooter-widget-area -->
        <div  id="g1-prefooter-widget-area" class="g1-layout-inner">
            <?php 
    foreach ($g1_rows as $g1_row) {
        ?>
            <div class="g1-grid">
                <?php 
Esempio n. 13
0
 /**
  * Shortcode callback function.
  *
  * @return string
  */
 protected function do_shortcode()
 {
     $error_message = $this->test_dependencies();
     if (!empty($error_message)) {
         return $error_message;
     }
     extract($this->extract());
     // Sanitize arguments
     $username = preg_replace('/[^0-9a-zA-Z_-]/', '', $username);
     $max = absint($max);
     $cache_duration = abs(g1_get_theme_option('twitter', 'cache_duration', ''));
     if (strlen($cache_duration) === 0) {
         $cache_duration = 3600;
     } else {
         $cache_duration = abs($cache_duration);
     }
     $autoplay = g1_get_theme_option('twitter', 'autoplay') === 'standard';
     $include_rts = g1_get_theme_option('twitter', 'retweets') === 'standard';
     $oauth_enabled = (bool) g1_get_theme_option('twitter', 'oauth_enabled', true);
     // build oAuth config
     $config['key'] = g1_get_theme_option('twitter', 'consumer_key', '');
     $config['secret'] = g1_get_theme_option('twitter', 'consumer_secret', '');
     $config['token'] = g1_get_theme_option('twitter', 'access_token', '');
     $config['token_secret'] = g1_get_theme_option('twitter', 'access_token_secret', '');
     $config['screenname'] = $username;
     $config['cache_expire'] = 0;
     $wp_upload_dir = wp_upload_dir();
     $config['directory'] = trailingslashit($wp_upload_dir['basedir']);
     $oauth_configured = !empty($config['key']) && !empty($config['secret']) && !empty($config['token']) && !empty($config['token_secret']);
     $use_oauth = $oauth_enabled && $oauth_configured;
     // Compose the transient name
     if ($use_oauth) {
         $transient = 'g1_twitter_oauth_' . $config['screenname'] . '_' . $max;
     } else {
         $transient = 'g1_twitter_' . $username . '_' . $max;
     }
     $out = '';
     $tweets = $cache_duration > 0 ? get_transient($transient) : false;
     if (false === $tweets) {
         // fetch tweets
         if ($use_oauth) {
             require_once 'StormTwitter.class.php';
             $obj = new StormTwitter($config);
             $res = $obj->getTweets($max);
             if (empty($res)) {
                 return $out;
             }
             $tweets = $res;
         } else {
             // Compose the resource URL
             $resource = 'https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=' . $username . '&count=' . $max;
             if ($include_rts) {
                 $resource .= '&include_rts=1';
             }
             $result = wp_remote_get($resource);
             if (is_wp_error($result)) {
                 return $out;
             }
             $json = $result['body'];
             // Convert JSON String to PHP Array
             $tweets = json_decode($json);
         }
         // Set transient
         if ($cache_duration > 0) {
             set_transient($transient, $tweets, $cache_duration);
         }
     }
     $secondsOffset = 0;
     $timezoneOffset = get_option('gmt_offset');
     if (is_numeric($timezoneOffset)) {
         $secondsOffset = $timezoneOffset * 3600;
     }
     // Compose output
     foreach ((array) $tweets as $tweet) {
         if (is_array($tweet)) {
             $tweet = (object) $tweet;
         }
         if (empty($tweet->text)) {
             continue;
         }
         $_out = "\t\t" . '<li>' . "\n" . "\t\t\t" . '<div class="g1-twitter__item">' . "\n" . "\t\t\t\t" . '<p class="g1-tweet-text">%tweet_text%</p>' . "\n" . "\t\t\t\t" . '<p class="g1-meta"><a href="%tweet_href%" rel="bookmark">%tweet_time%, %tweet_date%</a></p>' . "\n" . "\t\t\t" . '</div>' . "\n" . "\t\t" . '</li>' . "\n";
         $_out = str_replace(array('%tweet_text%', '%tweet_href%', '%tweet_time%', '%tweet_date%'), array($this->twitter_linkify($tweet->text), esc_url('http://twitter.com/' . $username . '/status/' . $tweet->id_str), date(get_option('time_format'), strtotime($tweet->created_at) + $secondsOffset), date(get_option('date_format'), strtotime($tweet->created_at) + $secondsOffset)), $_out);
         $out .= $_out;
     }
     $classes = array('g1-twitter', 'g1-twitter--' . $type, $use_oauth ? 'g1-auth-oauth' : 'g1-auth-simple', $autoplay ? 'g1-autoplay-on' : 'g1-autoplay-off');
     $classes = array_merge($classes, explode(' ', $class));
     $out = '<div class="' . sanitize_html_classes($classes) . '">' . "\n" . "\t" . '<ul class="g1-twitter__items">' . "\n" . $out . "\t" . '</ul>' . "\n" . "\t" . '<p class="g1-twitter__follow"><a href="' . esc_url('http://twitter.com/' . $username) . '">' . sprintf(__('Follow @%s', 'g1_theme'), esc_html($username)) . '</a>' . '</p>' . "\n" . '</div>';
     return $out;
 }
Esempio n. 14
0
 /**
  * Enqueues JavaScripts
  */
 public function enqueue_scripts()
 {
     // Prevent CSS|JS caching during updates
     $version = G1_Theme()->get_version();
     $parent_uri = trailingslashit(get_template_directory_uri());
     $child_uri = trailingslashit(get_stylesheet_directory_uri());
     $uri = get_template_directory_uri();
     wp_register_script('metadata', $parent_uri . 'js/jquery-metadata/jquery.metadata.js', array('jquery'), $version, true);
     wp_register_script('easing', $parent_uri . 'js/easing/jquery.easing.1.3.js', array('jquery'), $version, true);
     wp_register_script('g1_main', $parent_uri . 'js/main.js', array('jquery'), $version, true);
     wp_register_script('modernizr', $parent_uri . 'js/modernizr/modernizr.custom.js', array(), $version, false);
     wp_register_script('simplemodal', trailingslashit(G1_FRAMEWORK_URI) . 'js/jquery.simplemodal/js/jquery.simplemodal.1.4.1.min.js', array('jquery'), $version, true);
     wp_register_script('helpmode', trailingslashit(G1_FRAMEWORK_URI) . 'js/help-mode.js', array('jquery'), $version, true);
     wp_register_script('jquery.isotope', $parent_uri . 'js/jquery.isotope/jquery.isotope.min.js', array('jquery'), $version, true);
     wp_register_script('breakpoints', $parent_uri . 'js/breakpoints/breakpoints.js', array('jquery'), $version, true);
     wp_register_script('galleria', $parent_uri . 'js/galleria/galleria-1.2.9.min.js', array('jquery'), $version, true);
     wp_register_script('galleria_theme', $parent_uri . 'js/galleria/themes/classic/galleria.classic.js', array('galleria'), $version, true);
     wp_register_script('caroufredsel', $parent_uri . 'js/carouFredSel/jquery.carouFredSel-6.2.1-packed.js', array('jquery'), $version, true);
     wp_register_script('jquery.touchSwipe', $parent_uri . 'js/jquery.touchSwipe/jquery.touchSwipe.min.js', array('jquery'), $version, true);
     wp_register_script('jquery.waypoints', $parent_uri . 'js/jquery-waypoints/waypoints.min.js', array('jquery'), $version, true);
     wp_register_script('skrollr', $parent_uri . 'js/skrollr/skrollr.min.js', array(), '0.5.14', true);
     wp_register_script('jquery.magnific-popup', $parent_uri . 'js/jquery.magnific-popup/jquery.magnific-popup.min.js', array('jquery'), $version, true);
     wp_register_script('jquery.smoothscroll', $parent_uri . 'js/jquery.smoothscroll/jquery.smoothscroll.js', array('jquery'), $version, true);
     // Register child theme related scripts
     if ($parent_uri !== $child_uri) {
         wp_register_script('g1_child_main', $child_uri . 'modifications.js', array('jquery', 'g1_main'), false, true);
     }
     // Enqueue javascripts
     wp_enqueue_script('jquery');
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     wp_enqueue_script('metadata');
     wp_enqueue_script('easing');
     wp_enqueue_script('breakpoints');
     wp_enqueue_script('galleria');
     wp_enqueue_script('galleria_theme');
     wp_enqueue_script('caroufredsel');
     wp_enqueue_script('jquery.touchSwipe');
     wp_enqueue_script('jquery.waypoints');
     wp_enqueue_script('skrollr');
     wp_enqueue_script('jquery.magnific-popup');
     wp_enqueue_script('jquery.smoothscroll');
     wp_enqueue_script('g1_main');
     wp_enqueue_script('modernizr');
     $theme_data = array('uri' => $uri);
     wp_localize_script('g1_main', 'g1Theme', $theme_data);
     if (current_user_can('administrator') && 'none' !== g1_get_theme_option('general', 'helpmode')) {
         wp_enqueue_script('simplemodal');
         wp_enqueue_script('helpmode');
     }
     //Enqueue child theme related scripts
     if ($parent_uri !== $child_uri) {
         wp_enqueue_script('g1_child_main');
     }
 }
Esempio n. 15
0
 /**
  * Processes fonts
  */
 public function process()
 {
     $config = array('important' => array('selectors' => array('h1', '.g1-h1', 'h2', '.g1-h2', 'h3', '.g1-h3', '.g1-button--big', '.g1-numbers__title', '.g1-searchbox input', '.g1-nav--collapsed #g1-primary-nav-menu .g1-type-tile .g1-submenus .g1-nav-item__title')), 'regular' => array('selectors' => array('body', 'input', 'select', 'textarea')), 'meta' => array('selectors' => array('.g1-meta')), 'primary_nav' => array('selectors' => array('#g1-primary-nav-menu > li > a > .g1-nav-item__title', '#g1-header .g1-searchbox__switch', '#g1-header .g1-cartbox__switch')));
     // Apply custom filter
     $config = apply_filters('g1_fonts_config', $config);
     $to_process = array();
     $to_load = array();
     foreach ($config as $id => $args) {
         $type = g1_get_theme_option('style_fonts', $id . '_type');
         switch ($type) {
             case 'system':
                 $font_id = g1_get_theme_option('style_fonts', $id . '_system_font');
                 if ($this->has_font($font_id)) {
                     $to_process[$id] = $font_id;
                     $to_load[] = $font_id;
                 }
                 break;
             case 'font-face':
                 $font_id = g1_get_theme_option('style_fonts', $id . '_fontface_font');
                 if ($this->has_font($font_id)) {
                     $to_process[$id] = $font_id;
                     $to_load[] = $font_id;
                 }
                 break;
             case 'google':
                 $font_id = g1_get_theme_option('style_fonts', $id . '_google_font');
                 if (!$this->has_font('google_' . $font_id)) {
                     $this->add_font(new G1_Google_API_Font('google_' . $font_id, array('name' => $font_id)));
                 }
                 if ($this->has_font('google_' . $font_id)) {
                     $to_process[$id] = 'google_' . $font_id;
                     $to_load[] = 'google_' . $font_id;
                 }
                 break;
         }
     }
     // Load resources
     foreach ($to_load as $font_id) {
         $font = $this->get_font($font_id);
         $font->load_resources();
     }
     // Process each font
     foreach ($to_process as $config_id => $font_id) {
         $font = $this->get_font($font_id);
         // Bind
         $font->add_config($config[$config_id]);
         $font->process();
     }
 }
Esempio n. 16
0
    -ms-border-radius:<?php 
    echo $g1_border_radius;
    ?>
;
    -o-border-radius:<?php 
    echo $g1_border_radius;
    ?>
;
    border-radius:<?php 
    echo $g1_border_radius;
    ?>
;
    }
<?php 
}
$g1 = (array) g1_get_theme_option('style', 'ui_corners', array());
$g1_ui_tl = '0';
$g1_ui_tl = 'squircle' === $g1['tl'] ? '5px' : $g1_ui_tl;
$g1_ui_tl = 'circle' === $g1['tl'] ? '12px' : $g1_ui_tl;
$g1_ui_tr = '0';
$g1_ui_tr = 'squircle' === $g1['tr'] ? '5px' : $g1_ui_tr;
$g1_ui_tr = 'circle' === $g1['tr'] ? '12px' : $g1_ui_tr;
$g1_ui_br = '0';
$g1_ui_br = 'squircle' === $g1['br'] ? '5px' : $g1_ui_br;
$g1_ui_br = 'circle' === $g1['br'] ? '12px' : $g1_ui_br;
$g1_ui_bl = '0';
$g1_ui_bl = 'squircle' === $g1['bl'] ? '5px' : $g1_ui_bl;
$g1_ui_bl = 'circle' === $g1['bl'] ? '12px' : $g1_ui_bl;
$g1_border_radius = $g1_ui_tl . ' ' . $g1_ui_tr . ' ' . $g1_ui_br . ' ' . $g1_ui_bl;
?>
    input,
Esempio n. 17
0
 /**
  * Captures HTML with site identification.
  *
  * @return string
  */
 public function capture_site_id()
 {
     $out = '';
     // Get all required data
     $name = get_bloginfo('name');
     $description = get_bloginfo('description');
     $desktop_src = g1_get_theme_option('branding', 'logo');
     // Compose logo element
     $out_desktop = '';
     $out_mobile = '';
     // image logo
     if (!empty($desktop_src)) {
         $set = array();
         // set desktop logo as a defualt for every media width
         $data = array('data-g1-src-desktop' => $desktop_src, 'data-g1-src-desktop-hdpi' => $desktop_src, 'data-g1-src-mobile' => $desktop_src, 'data-g1-src-mobile-hdpi' => $desktop_src);
         // Desktop - HDPI screens
         $desktop_hdpi_src = g1_get_theme_option('branding', 'logo_hdpi');
         if (!empty($desktop_hdpi_src)) {
             $data['data-g1-src-desktop-hdpi'] = $desktop_hdpi_src;
         }
         // Mobile
         $mobile_src = g1_get_theme_option('branding', 'logo_mobile');
         if (!empty($mobile_src)) {
             $data['data-g1-src-mobile'] = $mobile_src;
         }
         // Mobile - HDPI screens
         $mobile_hdpi_src = g1_get_theme_option('branding', 'logo_mobile_hdpi');
         if (!empty($mobile_hdpi_src)) {
             $data['data-g1-src-mobile-hdpi'] = $mobile_hdpi_src;
         } else {
             if (!empty($desktop_hdpi_src)) {
                 $data['data-g1-src-mobile-hdpi'] = $desktop_hdpi_src;
             }
         }
         // markup
         $data_desktop_str = sprintf(' %s="%s"', 'data-g1-src-desktop', esc_url($data['data-g1-src-desktop']));
         $data_desktop_str .= sprintf(' %s="%s"', 'data-g1-src-desktop-hdpi', esc_url($data['data-g1-src-desktop-hdpi']));
         $data_mobile_str = sprintf(' %s="%s"', 'data-g1-src-mobile', esc_url($data['data-g1-src-mobile']));
         $data_mobile_str .= sprintf(' %s="%s"', 'data-g1-src-mobile-hdpi', esc_url($data['data-g1-src-mobile-hdpi']));
         $data_desktop_str = trim($data_desktop_str);
         $data_mobile_str = trim($data_mobile_str);
         $size_desktop = '';
         $logo_width = absint(g1_get_theme_option('branding', 'logo_width'));
         $logo_height = absint(g1_get_theme_option('branding', 'logo_height'));
         if (!empty($logo_width) && !empty($logo_height)) {
             $size_desktop = sprintf(' width="%s" height="%s"', $logo_width, $logo_height);
         }
         $size_mobile = '';
         $logo_mobile_width = absint(g1_get_theme_option('branding', 'logo_mobile_width'));
         $logo_mobile_height = absint(g1_get_theme_option('branding', 'logo_mobile_height'));
         if (!empty($logo_mobile_width) && !empty($logo_mobile_height)) {
             $size_mobile = sprintf(' width="%s" height="%s"', $logo_mobile_width, $logo_mobile_height);
         } else {
             if (!empty($logo_width) && !empty($logo_height)) {
                 $size_mobile = sprintf(' width="%s" height="%s"', $logo_width, $logo_height);
             }
         }
         $out_desktop = '<img' . $size_desktop . ' id="g1-logo" src="' . esc_url($desktop_src) . '" alt="' . esc_attr($name) . '" ' . $data_desktop_str . ' />
             <noscript><img src="' . esc_url($desktop_src) . '" alt="' . esc_attr($name) . '" /></noscript>';
         $out_mobile = '<img' . $size_mobile . ' id="g1-mobile-logo" src="' . esc_url($data['data-g1-src-mobile']) . '" alt="' . esc_attr($name) . '" ' . $data_mobile_str . ' />';
         // text logo
     } else {
         $out_desktop = esc_html($name);
     }
     $markup = apply_filters('g1_site_id_markup', '<h1 class="site-title"><a href="%1$s">%2$s</a></h1>');
     $out .= '<div id="g1-id">';
     $out .= sprintf($markup, esc_url(home_url()), $out_desktop . $out_mobile);
     // Capture tagline
     if ('none' !== g1_get_theme_option('ta_header', 'tagline') && strlen($description)) {
         if (is_front_page()) {
             $out .= '<p class="site-description"><strong>' . esc_html($description) . '</strong></p>';
         } else {
             $out .= '<p class="site-description">' . esc_html($description) . '</p>';
         }
     }
     $out .= '</div><!-- #id -->';
     return $out;
 }
Esempio n. 18
0
    ?>
                                <p class="g1-cartbox__empty"><?php 
    _e('No products in the cart.', 'woocommerce');
    ?>
</p>
                            </div>

                        </div>
                    </div>
                    <?php 
}
?>

                    <?php 
$g1_value = g1_get_theme_option('ta_header', 'searchform');
$g1_layout = g1_get_theme_option('ta_header', 'layout', 'semi-standard');
$g1_class = array('g1-searchbox', 'g1-searchbox--' . $g1_value, 'g1-searchbox--' . $g1_layout);
?>
                    <?php 
if ('none' !== $g1_value && !is_404()) {
    ?>
                    <div class="<?php 
    echo sanitize_html_classes($g1_class);
    ?>
">
                        <a class="g1-searchbox__switch" href="#">
                            <div class="g1-searchbox__arrow"></div>
                            <strong><?php 
    _ex('&nbsp;', 'searchbox switch label', 'g1_theme');
    ?>
</strong>
Esempio n. 19
0
 protected function get_page_id()
 {
     return g1_get_theme_option('maintenance_mode', 'page_id', '');
 }
Esempio n. 20
0
 /**
  * Registers custom tag (taxonomy to be exact)
  *
  * If you want to modify some paremeters, hook into the g1_pre_register_custonomy custom filter.
  */
 public function register_tag()
 {
     $slug = sanitize_title(g1_get_theme_option('taxonomy_' . $this->get_tag_taxonomy(), 'rewrite_slug'));
     $slug = strlen($slug) ? $slug : 'work-tag';
     // Compose arguments for g1_work_tag
     $args = array('label' => __('Work Tag', 'g1_theme'), 'labels' => array('name' => __('Work Tags', 'g1_theme'), 'singular_name' => __('Work Tag', 'g1_theme'), 'search_items' => __('Search Work Tags', 'g1_theme'), 'popular_items' => __('Popular Work Tags', 'g1_theme'), 'all_items' => __('All Work Tags', 'g1_theme'), 'parent_item' => __('Parent Work Tag', 'g1_theme'), 'parent_item_colon' => __('Parent Work Tag:', 'g1_theme'), 'edit_item' => __('Edit Work Tag', 'g1_theme'), 'update_item' => __('Update Work Tag', 'g1_theme'), 'add_new_item' => __('Add New Work Tag', 'g1_theme'), 'new_item_name' => __('New Work Tag', 'g1_theme'), 'menu_name' => __('Work Tags', 'g1_theme')), 'query_var' => $this->get_tag_taxonomy(), 'rewrite' => array('slug' => _x($slug, 'URL slug', 'g1_theme'), 'with_front' => true), 'public' => true, 'hierarchical' => false, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true);
     // Apply custom filters (this way Child Themes can change some arguments)
     $args = apply_filters('g1_pre_register_taxonomy', $args, $this->get_category_taxonomy());
     register_taxonomy($this->get_tag_taxonomy(), array($this->get_post_type()), $args);
     $features = array('g1-archive-settings', 'g1-global-rewrite-slug', 'g1-global-archive-template', 'g1-individual-archive-template', 'g1-global-archive-posts-per-page', 'g1-individual-archive-posts-per-page', 'g1-global-archive-sidebar-1', 'g1-individual-archive-sidebar-1', 'g1-collection-global-elements', 'g1-collection-individual-elements', 'g1-single-entry-settings', 'g1-single-entry-template');
     foreach ($features as $feature) {
         add_taxonomy_support($this->get_tag_taxonomy(), $feature);
     }
 }
Esempio n. 21
0
 /**
  * Gets the default configuration for all sliders
  */
 public function get_default_config()
 {
     $defaults = $this->get_default_values();
     $config = array('layout' => $defaults['layout'], 'width' => $defaults['width'], 'animation' => g1_get_theme_option('simple_slider', 'animation', $defaults['animation']), 'animationDuration' => g1_get_theme_option('simple_slider', 'animationDuration', $defaults['animationDuration']) * 1000, 'slideshowSpeed' => g1_get_theme_option('simple_slider', 'slideshowSpeed', $defaults['slideshowSpeed']) * 1000, 'autoplay' => g1_get_theme_option('simple_slider', 'autoplay', $defaults['autoplay']), 'fullscreen' => g1_get_theme_option('simple_slider', 'fullscreen', $defaults['fullscreen']), 'coinNavigation' => g1_get_theme_option('simple_slider', 'coinNavigation', $defaults['coinNavigation']), 'directionNavigation' => g1_get_theme_option('simple_slider', 'directionNavigation', $defaults['directionNavigation']), 'progressBar' => g1_get_theme_option('simple_slider', 'progressBar', $defaults['progressBar']));
     return $config;
 }
Esempio n. 22
0
 /**
  * Gets breadcrumbs for the current context.
  *
  * If you want to add/delete some choices, hook into the g1_breadcrumbs custom filter.
  *
  * @return array
  */
 public function get()
 {
     global $post;
     $this->breadcrumbs = array();
     $this->breadcrumbs[] = array('href' => home_url('/'), 'text' => __('Home', 'g1_theme'));
     // Blog Page
     if (is_home() && !is_front_page()) {
         $id = intval(g1_get_theme_option('post_type_post', 'page_for_posts'));
         // WPML fallback
         if (function_exists('icl_object_id')) {
             $id = absint(icl_object_id($id, 'page', true));
         }
         if ($id) {
             $href = get_permalink($id);
             $text = get_the_title($id);
             $this->breadcrumbs[] = array('href' => $href, 'text' => $text);
         }
     } elseif (is_singular()) {
         if (!is_page()) {
             if ('post' == get_post_type()) {
                 $id = intval(g1_get_theme_option('post_type_post', 'page_for_posts'));
                 // WPML fallback
                 if (function_exists('icl_object_id')) {
                     $id = absint(icl_object_id($id, 'page', true));
                 }
                 if ($id) {
                     $href = get_permalink($id);
                     $text = get_the_title($id);
                     $this->breadcrumbs[] = array('href' => $href, 'text' => $text);
                 }
             } elseif (!is_attachment()) {
                 $post_type_obj = get_post_type_object(get_post_type());
                 if ($post_type_obj) {
                     $href = get_post_type_archive_link(get_post_type());
                     $text = apply_filters('post_type_archive_title', $post_type_obj->labels->name);
                     $this->breadcrumbs[] = array('href' => $href, 'text' => $text);
                 }
             }
         }
         // Add subpages if any
         if ($post->post_parent) {
             $parent_id = $post->post_parent;
             $parent_breadcrumbs = array();
             while ($parent_id) {
                 $page = get_page($parent_id);
                 $parent_breadcrumbs[] = array('href' => get_permalink($page->ID), 'text' => get_the_title($page->ID));
                 $parent_id = $page->post_parent;
             }
             $parent_breadcrumbs = array_reverse($parent_breadcrumbs);
             $this->breadcrumbs = array_merge($this->breadcrumbs, $parent_breadcrumbs);
         }
         // Add the current page
         $this->breadcrumbs[] = array('href' => get_permalink($post->ID), 'text' => get_the_title($post->ID));
     } elseif (is_post_type_archive()) {
         $post_type = get_post_type();
         $href = get_post_type_archive_link($post_type);
         $text = post_type_archive_title('', false);
         $page_id = G1_Archive_Page_Feature()->get_page_id($post_type);
         // WPML fallback
         if (function_exists('icl_object_id')) {
             $page_id = absint(icl_object_id($page_id, 'page', true));
         }
         if (!empty($page_id)) {
             $title = get_the_title($page_id);
         }
         if (!empty($title)) {
             $text = $title;
         }
         $this->breadcrumbs[] = array('href' => $href, 'text' => $text);
     } elseif (is_category()) {
         $category_id = get_query_var('cat');
         $category = get_category($category_id);
         // Temporary array for the current category and parents (if any)
         $temp = array();
         while ($category_id) {
             $temp[] = array('href' => get_category_link($category_id), 'text' => get_cat_name($category_id));
             /* Check for a parent category */
             if ($category->category_parent) {
                 $category_id = $category->category_parent;
                 $category = get_category($category_id);
             } else {
                 $category_id = 0;
             }
         }
         if (count($temp)) {
             $temp = array_reverse($temp);
         }
         /* Merge with temporary array */
         $this->breadcrumbs = array_merge($this->breadcrumbs, $temp);
     } elseif (is_tag()) {
         $this->add_tag_breadcrumbs();
     } elseif (is_tax()) {
         $this->add_tax_breadcrumbs();
     } elseif (is_year()) {
         $this->add_year_breadcrumbs();
     } elseif (is_month()) {
         $this->add_month_breadcrumbs();
     } elseif (is_day()) {
         $this->add_day_breadcrumbs();
     } elseif (is_author()) {
         $this->add_author_breadcrumbs();
     } elseif (is_search()) {
         $this->add_search_breadcrumbs();
     } elseif (is_404()) {
         $this->add_404_breadcrumbs();
     }
     // Call the functions added to a filter hook
     $this->breadcrumbs = apply_filters('g1_breadcrumbs', $this->breadcrumbs);
     $this->remove_duplicates();
     return $this->breadcrumbs;
 }
Esempio n. 23
0
 public function get_mailing_list_choices()
 {
     $api_key = g1_get_theme_option('mailchimp', 'api_key', '');
     $choices = array();
     if (!empty($api_key)) {
         $api_version = G1_Mailchimp_Module()->get_api_version();
         $debug_mode = true === G1_Mailchimp_Module()->get_debug_mode();
         if ($api_version === '1.0') {
             if (!class_exists('MCAPI')) {
                 require_once dirname(__FILE__) . '/lib/MCAPI.class.php';
             }
             $mcapi = new MCAPI($api_key);
             $mc_lists = $mcapi->lists();
             if (empty($mcapi->errorCode) && $mc_lists['total'] > 0) {
                 foreach ($mc_lists['data'] as $mc_list) {
                     $list_id = $mc_list['id'];
                     $list_name = $mc_list['name'];
                     $choices[$list_id] = $list_name;
                 }
             }
         }
         if ($api_version === '2.0') {
             if (!class_exists('Mailchimp')) {
                 require_once dirname(__FILE__) . '/lib/Mailchimp.php';
             }
             $api = new Mailchimp($api_key, array('debug' => $debug_mode));
             try {
                 $res = $api->call('lists/list', array());
                 if (!empty($res['errors'])) {
                     foreach ($res['errors'] as $error) {
                         $choices[] = $error;
                     }
                 } else {
                     if (abs($res['total']) > 0) {
                         foreach ($res['data'] as $list) {
                             $id = $list['id'];
                             $name = $list['name'];
                             $choices[$id] = $name;
                         }
                     }
                 }
             } catch (Mailchimp_Error $e) {
                 if ($debug_mode) {
                     $choices[] = $e->getMessage() . ' (code: ' . $e->getCode() . ')';
                 }
             }
         }
     } else {
         $choices[] = __('To fetch the list you need to enter your MailChimp Api Key in the theme options panel.', 'g1_theme');
     }
     if (empty($choices)) {
         $choices[] = __('Some errors occurred while fetching Mailchimp data.', 'g1_theme');
     }
     return $choices;
 }
Esempio n. 24
0
?>
	
	<!-- BEGIN #g1-footer -->
	<footer id="g1-footer" class="g1-footer" role="contentinfo">
            <?php 
/* Executes a custom hook.
 * If you want to add some content before the g1-footer-area,
 * hook into 'g1_footer_begin' action.
 */
do_action('g1_footer_begin');
?>

            <!-- BEGIN #g1-footer-area -->
            <div id="g1-footer-area" class="g1-layout-inner">
                <p id="g1-footer-text"><?php 
echo g1_get_theme_option('general', 'footer_text', '');
?>
</p>
            </div>
            <!-- END #g1-footer-area -->

            <?php 
/* Executes a custom hook.
 * If you want to add some content after the g1-footer-area,
 * hook into 'g1_footer_end' action.
 */
do_action('g1_footer_end');
?>

        <?php 
get_template_part('template-parts/g1_background', 'footer');