/** * Add new fields to customizer, create panel 'Other' and register postMessage support for site title and description for the Customizer. * * @param WP_Customize_Manager $wp_customize Customizer object. * @since SG Window 1.0.0 */ function sgwindow_customize_register_other($wp_customize) { $defaults = sgwindow_get_defaults(); $wp_customize->add_panel('other', array('priority' => 106, 'title' => __('Customize Other Settings', 'sg-window'), 'description' => __('All other settings.', 'sg-window'))); $section_priority = 10; //New section in customizer: Logotype $wp_customize->add_section('sgwindow_theme_logotype', array('title' => __('Logotype', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'other')); //New setting in Logotype section: Logo Image $wp_customize->add_setting('logotype_url', array('default' => get_template_directory_uri() . '/img/logo.png', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_url')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logotype_url', array('label' => __('Logotype Image', 'sg-window'), 'section' => 'sgwindow_theme_logotype', 'settings' => 'logotype_url', 'priority' => '1'))); //New section in customizer: Fixed Background $wp_customize->add_section('column_background_url', array('title' => __('Fixed Background', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'background')); //column background image $wp_customize->add_setting('column_background_url', array('default' => $defaults['column_background_url'], 'transport' => 'postMessage', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_background_url')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'column_background_url', array('label' => __('Site Background', 'sg-window'), 'section' => 'column_background_url', 'settings' => 'column_background_url', 'priority' => 1))); //background position $wp_customize->add_setting('top', array('default' => $defaults['top'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_background_position')); $wp_customize->add_control('top', array('label' => __('Vertical position', 'sg-window'), 'section' => 'column_background_url', 'settings' => 'top', 'type' => 'select', 'priority' => 2, 'choices' => array('top' => __('Top', 'sg-window'), 'center' => __('Center', 'sg-window'), 'bottom' => __('Bottom', 'sg-window')))); //New section in customizer: Navigation Options $wp_customize->add_section('sgwindow_nav_options', array('title' => __('Navigation menu settings', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'navigation')); //New setting in Navigation section: Switch On First Top Menu $wp_customize->add_setting('is_show_top_menu', array('default' => $defaults['is_show_top_menu'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_show_top_menu', array('label' => __('Switch On First Top Menu', 'sg-window'), 'section' => 'sgwindow_nav_options', 'settings' => 'is_show_top_menu', 'type' => 'checkbox', 'priority' => $section_priority++, 'panel' => 'other')); //New setting in Navigation section: Switch On Second Top Menu $wp_customize->add_setting('is_show_secont_top_menu', array('default' => $defaults['is_show_secont_top_menu'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('sgwindow_is_show_secont_top_menu', array('label' => __('Switch On Second Top Menu', 'sg-window'), 'section' => 'sgwindow_nav_options', 'settings' => 'is_show_secont_top_menu', 'type' => 'checkbox', 'priority' => 22)); //New setting in Navigation section: Switch On Footer Menu $wp_customize->add_setting('is_show_footer_menu', array('default' => $defaults['is_show_footer_menu'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('sgwindow_is_show_footer_menu', array('label' => __('Switch On Footer Menu', 'sg-window'), 'section' => 'sgwindow_nav_options', 'settings' => 'is_show_footer_menu', 'type' => 'checkbox', 'priority' => 23)); //New section in the customizer: Scroll To Top Button $wp_customize->add_section('sgwindow_scroll', array('title' => __('Scroll To Top Button', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'other')); $wp_customize->add_setting('scroll_button', array('default' => $defaults['scroll_button'], 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'sgwindow_sanitize_scroll_button')); $wp_customize->add_control('scroll_button', array('label' => __('How to display the scroll to top button', 'sg-window'), 'section' => 'sgwindow_scroll', 'settings' => 'scroll_button', 'type' => 'select', 'priority' => 1, 'choices' => array('none' => __('None', 'sg-window'), 'right' => __('Right', 'sg-window'), 'left' => __('Left', 'sg-window'), 'center' => __('Center', 'sg-window')))); $wp_customize->add_setting('scroll_animate', array('default' => $defaults['scroll_animate'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_scroll_effect')); $wp_customize->add_control('scroll_animate', array('label' => __('How to animate the scroll to top button', 'sg-window'), 'section' => 'sgwindow_scroll', 'settings' => 'scroll_animate', 'type' => 'select', 'priority' => 1, 'choices' => array('none' => __('None', 'sg-window'), 'move' => __('Jump', 'sg-window')))); //New section in the customizer: Favicon $wp_customize->add_section('sgwindow_favicon', array('title' => __('Favicon', 'sg-window'), 'description' => __('You can select an Icon to be shown at the top of browser window by uploading from your computer. (Size: [16X16] px)', 'sg-window'), 'priority' => $section_priority++, 'panel' => 'other')); $wp_customize->add_setting('favicon', array('default' => $defaults['favicon'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_url')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'favicon', array('label' => __('Favicon', 'sg-window'), 'section' => 'sgwindow_favicon', 'settings' => 'favicon', 'priority' => '1'))); sgwindow_create_social_icons_section($wp_customize); $wp_customize->add_setting('is_header_on_front_page_only', array('default' => $defaults['is_header_on_front_page_only'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_header_on_front_page_only', array('label' => __('Display Header Image on the Front Page only', 'sg-window'), 'section' => 'header_image', 'settings' => 'is_header_on_front_page_only', 'type' => 'checkbox', 'priority' => 40)); $wp_customize->add_setting('is_text_on_front_page_only', array('default' => $defaults['is_text_on_front_page_only'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_text_on_front_page_only', array('label' => __('Display Header Text on the Front Page only', 'sg-window'), 'section' => 'header_image', 'settings' => 'is_text_on_front_page_only', 'type' => 'checkbox', 'priority' => 41)); $wp_customize->add_section('check', array('title' => __('--', 'sg-window'), 'priority' => 200, 'panel' => 'other')); if ('' == sgwindow_get_theme_mod('are_we_saved', '')) { $wp_customize->add_setting('are_we_saved', array('type' => 'theme_mod', 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('are_we_saved', array('label' => __('--', 'sg-window'), 'section' => 'check', 'settings' => 'are_we_saved', 'type' => 'checkbox', 'priority' => 1)); } $wp_customize->add_setting('max_id', array('type' => 'theme_mod', 'default' => '0', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control('max_id', array('label' => __('Max id', 'sg-window'), 'section' => 'check', 'settings' => 'max_id', 'type' => 'input')); }
function __construct() { $defaults = sgwindow_get_defaults(); $this->color_scheme = sgwindow_get_theme_mod('color_scheme', $defaults['color_scheme']); $this->add_scheme(0, __('Blue', 'sg-window')); $this->add_scheme(1, __('Green', 'sg-window')); $this->add_scheme(2, __('Blue-White', 'sg-window')); $section_id = 'main_colors'; $section_priority = 10; $p = 10; $this->add_section($section_id, __('Main Colors', 'sg-window'), __('Main website colors', 'sg-window'), $section_priority++); /* colors */ $i = 'link_color'; $this->add_color($i, $section_id, __('Link', 'sg-window'), $p++, false); $this->set_color($i, 0, '#1e73be'); $this->set_color($i, 1, '#b7ba2a'); $this->set_color($i, 2, '#1e73be'); $i = 'heading_color'; $this->add_color($i, $section_id, __('H1-H6 heading', 'sg-window'), $p++, false); $this->set_color($i, 0, '#3f3f3f'); $this->set_color($i, 1, '#141414'); $this->set_color($i, 2, '#3f3f3f'); $i = 'heading_link'; $this->add_color($i, $section_id, __('H1-H6 Link', 'sg-window'), $p++, false); $this->set_color($i, 0, '#1e73be'); $this->set_color($i, 1, '#b7ba2a'); $this->set_color($i, 2, '#1e73be'); $i = 'description_color'; $this->add_color($i, $section_id, __('Description', 'sg-window'), $p++, false); $this->set_color($i, 0, '#ffffff'); $this->set_color($i, 1, '#fff'); $this->set_color($i, 2, '#ffffff'); $i = 'hover_color'; $this->add_color($i, $section_id, __('Link Hover', 'sg-window'), $p++, false, 'refresh'); $this->set_color($i, 0, '#45d61d'); $this->set_color($i, 1, '#dd3333'); $this->set_color($i, 2, '#45d61d'); add_action('customize_register', array($this, 'sgwindow_create_colors_controls'), 21); add_action('sgwindow_option_defaults', array($this, 'sgwindow_add_defaults')); add_action('customize_controls_print_scripts', array($this, 'sgwindow_print_customizer_js_colors')); }
/** * Return array column-content direction . * * @return array sanitized direction. * @since SG Window 1.0.0 */ function sgwindow_column_dir() { $rez = array(); switch (sgwindow_get_theme_mod('columns_direction')) { case 'c_1_2': $rez['content'] = 1; $rez['column-1'] = 2; $rez['column-2'] = 3; break; case '2_1_c': $rez['content'] = 3; $rez['column-1'] = 2; $rez['column-2'] = 1; break; case 'c_2_1': $rez['content'] = 1; $rez['column-1'] = 3; $rez['column-2'] = 2; break; case '1_c_2': $rez['content'] = 2; $rez['column-1'] = 1; $rez['column-2'] = 3; break; case '2_c_1': $rez['content'] = 2; $rez['column-1'] = 3; $rez['column-2'] = 1; break; case '1_2_c': $rez['content'] = 3; $rez['column-1'] = 1; $rez['column-2'] = 2; break; } return $rez; }
the_post(); get_template_part('content', 'jetpack-portfolio'); } ?> </div><!-- .content --> <div class="clear"></div> <?php sgwindow_post_nav(); if (comments_open() || get_comments_number()) { comments_template(); } } else { ?> <div class="content"> <?php get_template_part('content', 'none'); ?> </div><!-- .content --> <?php } ?> </div><!-- .site-content --> <?php sgwindow_get_sidebar(sgwindow_get_theme_mod('layout_portfolio-page')); ?> </div> <!-- .main-wrapper --> <?php get_footer();
/** * Enqueue parent and child scripts * * @package WordPress * @subpackage Dream Way * @since Dream Way 1.0 */ function dreamway_styles() { wp_enqueue_style('sgwindow-style', get_template_directory_uri() . '/style.css'); wp_enqueue_style('dreamway-style', get_stylesheet_uri(), array('sgwindow-style')); wp_enqueue_style('dreamway-colors', get_stylesheet_directory_uri() . '/css/scheme-' . esc_attr(sgwindow_get_theme_mod('color_scheme')) . '.css', array('dreamway-style', 'sgwindow-colors')); }
" <?php post_class(); ?> > <header class="entry-header"> <?php if ('1' == sgwindow_get_theme_mod('is_display_page_title')) { the_title('<h1 class="entry-title">', '</h1>'); } ?> <?php if (has_post_thumbnail() && '1' == sgwindow_get_theme_mod('is_display_page_image')) { ?> <div class="entry-thumbnail"> <?php the_post_thumbnail(); ?> </div> <?php } ?> </header><!-- .entry-header --> <div class="entry-content"> <?php the_content();
/** * Add custom styles to the header. * * @since SG Window 1.0.1 */ function sgwindow_hook_font_css() { $body_font = sgwindow_get_theme_mod('body_font'); $heading_font = sgwindow_get_theme_mod('heading_font'); if ('0' == $heading_font) { $heading_font = $body_font; } $header_font = sgwindow_get_theme_mod('header_font'); if ('0' == $header_font) { $header_font = $heading_font; } ?> <style type="text/css"> .site { <?php if ('0' != $body_font) { ?> font-family: '<?php echo esc_attr($body_font); ?> ', sans-serif; <?php } ?> font-size: <?php echo esc_attr(sgwindow_get_theme_mod('body_font_size')); ?> px; } h1, h2, h3, h4, h5, h6 { font-weight: <?php echo esc_attr(sgwindow_get_theme_mod('heading_weight')); ?> ; <?php if ('0' != $heading_font) { ?> font-family: '<?php echo esc_attr($heading_font); ?> ', sans-serif; <?php } ?> } <?php if ('0' != $header_font) { ?> .site .site-title h1, .site-title a { font-family: '<?php echo esc_attr($header_font); ?> ', sans-serif; } <?php } ?> @media screen and (min-width: 680px) { h1 { font-size:<?php echo esc_attr(sgwindow_get_theme_mod('heading_font_size')); ?> px; } } </style> <?php }
<div class="content-search"> <?php do_action('sgwindow_after_content'); ?> </div><!-- .content-search --> </div><!-- .content --> <div class="clear"></div> <?php sgwindow_paging_nav(); } else { ?> <div class="content"> <?php get_template_part('content', 'none'); ?> </div><!-- .content --> <?php } ?> </div><!-- .site-content --> <?php sgwindow_get_sidebar(sgwindow_get_theme_mod('layout_blog')); ?> </div> <!-- .main-wrapper --> <?php get_footer();
function get_width($sidebar_id) { $width = sgwindow_get_theme_mod('width_top_widget_area') - 4; return $width; }
<?php while (have_posts()) { the_post(); get_template_part('content', get_post_format()); } ?> </div><!-- .content --> <div class="clear"></div> <?php sgwindow_paging_nav(); } else { ?> <div class="content"> <?php get_template_part('content', 'none'); ?> </div><!-- .content --> <?php } ?> </div><!-- .site-content --> <?php sgwindow_get_sidebar(sgwindow_get_theme_mod('layout_default')); ?> </div> <!-- .main-wrapper --> <?php get_footer();
function sgwindow_create_section_layout($wp_customize) { $defaults = sgwindow_get_defaults(); $wp_customize->add_panel('layout', array('priority' => 1, 'title' => __('Customize Layout', 'sg-window'), 'description' => __('In this section you can choose layout settings.', 'sg-window'))); $section_priority = 10; $priority = 1; $wp_customize->add_section('size', array('priority' => $section_priority++, 'title' => __('Site size', 'sg-window'), 'description' => __('You can control main dimensions of your website from this section', 'sg-window'), 'panel' => 'layout')); //site width range + text $wp_customize->add_setting('width_site_range', array('type' => 'empty', 'default' => sgwindow_get_theme_mod('width_site'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'absint')); $wp_customize->add_control('width_site_range', array('label' => __('(px)', 'sg-window'), 'section' => 'size', 'settings' => 'width_site_range', 'type' => 'range', 'input_attrs' => array('min' => 960, 'max' => 2200, 'step' => 1), 'priority' => $priority++)); $wp_customize->add_setting('width_site', array('type' => 'theme_mod', 'default' => $defaults['width_site'], 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sgwindow_sanitize_range_width')); $wp_customize->add_control('width_site', array('label' => __('Width of the site', 'sg-window'), 'section' => 'size', 'settings' => 'width_site', 'type' => 'text', 'priority' => $priority++)); //Content full width $wp_customize->add_setting('width_content_no_sidebar', array('type' => 'theme_mod', 'default' => $defaults['width_content_no_sidebar'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_range_content')); $wp_customize->add_control('width_content_no_sidebar', array('label' => __('Max width of the content area (no columns layout)', 'sg-window'), 'section' => 'size', 'settings' => 'width_content_no_sidebar', 'type' => 'text', 'priority' => $priority++)); //content area width range + text $wp_customize->add_setting('width_main_wrapper_range', array('type' => 'empty', 'default' => sgwindow_get_theme_mod('width_main_wrapper'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'absint')); $wp_customize->add_control('width_main_wrapper_range', array('label' => __('(px)', 'sg-window'), 'section' => 'size', 'settings' => 'width_main_wrapper_range', 'type' => 'range', 'priority' => $priority++, 'input_attrs' => array('min' => 600, 'max' => 2200, 'step' => 1))); $wp_customize->add_setting('width_main_wrapper', array('type' => 'theme_mod', 'default' => $defaults['width_main_wrapper'], 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sgwindow_sanitize_range_content')); $wp_customize->add_control('width_main_wrapper', array('label' => __('Width of the content area (including columns)', 'sg-window'), 'section' => 'size', 'settings' => 'width_main_wrapper', 'type' => 'text', 'priority' => $priority++)); $wp_customize->add_setting('content_style', array('type' => 'theme_mod', 'default' => $defaults['content_style'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_header_style')); $wp_customize->add_control('content_style', array('label' => __('Content style', 'sg-window'), 'section' => 'size', 'settings' => 'content_style', 'type' => 'select', 'priority' => $priority++, 'choices' => array('boxed' => __('Boxed', 'sg-window'), 'full' => __('Full Width', 'sg-window')))); //Featured Image $wp_customize->add_section('post_thumbnail_size', array('priority' => $section_priority++, 'title' => __('Featured Image', 'sg-window'), 'description' => __('Image Size', 'sg-window'), 'panel' => 'layout')); $wp_customize->add_setting('post_thumbnail_size', array('type' => 'theme_mod', 'default' => $defaults['post_thumbnail_size'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control('post_thumbnail_size', array('label' => __('Width of the Featured Image (Images should be updated with Regenerate Thumbnails plugin).', 'sg-window'), 'section' => 'post_thumbnail_size', 'settings' => 'post_thumbnail_size', 'type' => 'number', 'priority' => $priority++)); //Columns width $wp_customize->add_section('columns', array('priority' => $section_priority++, 'title' => __('Columns', 'sg-window'), 'description' => __('You can set the size of columns in this section', 'sg-window'), 'panel' => 'layout')); $wp_customize->add_setting('unit', array('type' => 'theme_mod', 'default' => $defaults['unit'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control('unit', array('label' => __('Unit', 'sg-window'), 'section' => 'columns', 'settings' => 'unit', 'type' => 'select', 'priority' => $priority++, 'choices' => array(__('%', 'sg-window')))); //in % $wp_customize->add_setting('width_column_1_range_rate', array('type' => 'empty', 'default' => sgwindow_get_theme_mod('width_column_1_rate'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'absint')); $wp_customize->add_control('width_column_1_range_rate', array('label' => __('(%)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_1_range_rate', 'type' => 'range', 'priority' => $priority++, 'input_attrs' => array('min' => 10, 'max' => 50, 'step' => 1))); $wp_customize->add_setting('width_column_1_rate', array('type' => 'theme_mod', 'default' => sgwindow_get_theme_mod('width_column_1_rate'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sgwindow_sanitize_range_column_rate')); $wp_customize->add_control('width_column_1_rate', array('label' => __('Width of the first column (two sidebars layout)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_1_rate', 'type' => 'text', 'priority' => $priority++)); $wp_customize->add_setting('width_column_2_range_rate', array('type' => 'empty', 'default' => sgwindow_get_theme_mod('width_column_2_rate'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'absint')); $wp_customize->add_control('width_column_2_range_rate', array('label' => __('(%)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_2_range_rate', 'type' => 'range', 'priority' => $priority++, 'input_attrs' => array('min' => 10, 'max' => 50, 'step' => 1))); $wp_customize->add_setting('width_column_2_rate', array('type' => 'theme_mod', 'default' => $defaults['width_column_2_rate'], 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sgwindow_sanitize_range_column_rate')); $wp_customize->add_control('width_column_2_rate', array('label' => __('Width of the second column (two sidebars layout)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_2_rate', 'type' => 'text', 'priority' => $priority++)); $wp_customize->add_setting('width_column_1_left_range_rate', array('type' => 'empty', 'default' => sgwindow_get_theme_mod('width_column_1_left_rate'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'absint')); $wp_customize->add_control('width_column_1_left_range_rate', array('label' => __('(%)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_1_left_range_rate', 'type' => 'range', 'priority' => $priority++, 'input_attrs' => array('min' => 10, 'max' => 50, 'step' => 1))); $wp_customize->add_setting('width_column_1_left_rate', array('type' => 'theme_mod', 'default' => $defaults['width_column_1_left_rate'], 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sgwindow_sanitize_range_column_rate')); $wp_customize->add_control('width_column_1_left_rate', array('label' => __('Width of the first column (left sidebar layout)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_1_left_rate', 'type' => 'text', 'priority' => $priority++)); $wp_customize->add_setting('width_column_1_right_range_rate', array('type' => 'empty', 'default' => sgwindow_get_theme_mod('width_column_1_right_rate'), 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'absint')); $wp_customize->add_control('width_column_1_right_range_rate', array('label' => __('(%)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_1_right_range_rate', 'type' => 'range', 'priority' => $priority++, 'input_attrs' => array('min' => 10, 'max' => 50, 'step' => 1))); $wp_customize->add_setting('width_column_1_right_rate', array('type' => 'theme_mod', 'default' => $defaults['width_column_1_right_rate'], 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sgwindow_sanitize_range_column_rate')); $wp_customize->add_control('width_column_1_right_rate', array('label' => __('Width of the second column (right sidebar layout)', 'sg-window'), 'section' => 'columns', 'settings' => 'width_column_1_right_rate', 'type' => 'text', 'priority' => $priority++)); $wp_customize->add_setting('front_page_style', array('default' => $defaults['front_page_style'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('sgwindow_is_show_top_menu', array('label' => __('Check mark to display content on the static front page', 'sg-window'), 'section' => 'layout_home', 'settings' => 'front_page_style', 'type' => 'checkbox', 'priority' => $priority++)); /* layout_post */ $wp_customize->add_section('layout_post', array('priority' => $section_priority++, 'title' => __('Post', 'sg-window'), 'description' => __('Customize posts', 'sg-window'), 'panel' => 'layout')); $wp_customize->add_setting('single_style', array('type' => 'theme_mod', 'default' => $defaults['single_style'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_display_choices')); $wp_customize->add_control('single_style', array('label' => __('Post style', 'sg-window'), 'section' => 'layout_blog', 'settings' => 'single_style', 'type' => 'select', 'priority' => $priority++, 'choices' => sgwindow_display_choices())); $wp_customize->add_setting('is_display_post_image', array('type' => 'theme_mod', 'default' => $defaults['is_display_post_image'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_post_image', array('label' => __('Display Featured Image', 'sg-window'), 'section' => 'layout_post', 'settings' => 'is_display_post_image', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_post_title', array('type' => 'theme_mod', 'default' => $defaults['is_display_post_title'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_post_title', array('label' => __('Display Title', 'sg-window'), 'section' => 'layout_post', 'settings' => 'is_display_post_title', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_post_cat', array('type' => 'theme_mod', 'default' => $defaults['is_display_post_cat'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_post_cat', array('label' => __('Display Category List', 'sg-window'), 'section' => 'layout_post', 'settings' => 'is_display_post_cat', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_post_tags', array('type' => 'theme_mod', 'default' => $defaults['is_display_post_tags'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_post_tags', array('label' => __('Display Tag List', 'sg-window'), 'section' => 'layout_post', 'settings' => 'is_display_post_tags', 'type' => 'checkbox', 'priority' => $priority++)); /* layout_page */ $wp_customize->add_setting('page_style', array('type' => 'theme_mod', 'default' => $defaults['page_style'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitizeis_display_post_image')); $wp_customize->add_control('page_style', array('label' => __('Page style', 'sg-window'), 'section' => 'layout_blog', 'settings' => 'page_style', 'type' => 'select', 'priority' => $priority++, 'choices' => sgwindow_display_choices())); $wp_customize->add_setting('is_display_page_image', array('type' => 'theme_mod', 'default' => $defaults['is_display_page_image'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_page_image', array('label' => __('Display Featured Image', 'sg-window'), 'section' => 'layout_page', 'settings' => 'is_display_page_image', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_page_title', array('type' => 'theme_mod', 'default' => $defaults['is_display_page_title'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_page_title', array('label' => __('Display Title', 'sg-window'), 'section' => 'layout_page', 'settings' => 'is_display_page_title', 'type' => 'checkbox', 'priority' => $priority++)); /* layout_portfolio_page */ $wp_customize->add_setting('portfolio_style', array('type' => 'theme_mod', 'default' => $defaults['portfolio_style'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_display_choices')); $wp_customize->add_control('portfolio_style', array('label' => __('Portfolio Archive/Index style', 'sg-window'), 'section' => 'layout_portfolio', 'settings' => 'portfolio_style', 'type' => 'select', 'priority' => $priority++, 'choices' => sgwindow_display_choices())); $wp_customize->add_setting('is_display_portfolio_image', array('type' => 'theme_mod', 'default' => $defaults['is_display_portfolio_image'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_portfolio_image', array('label' => __('Display Featured Image', 'sg-window'), 'section' => 'layout_portfolio_page', 'settings' => 'is_display_portfolio_image', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_portfolio_title', array('type' => 'theme_mod', 'default' => $defaults['is_display_portfolio_title'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_portfolio_title', array('label' => __('Display Title', 'sg-window'), 'section' => 'layout_portfolio_page', 'settings' => 'is_display_portfolio_title', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_portfolio_project', array('type' => 'theme_mod', 'default' => $defaults['is_display_portfolio_project'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_portfolio_project', array('label' => __('Display Project', 'sg-window'), 'section' => 'layout_portfolio_page', 'settings' => 'is_display_portfolio_project', 'type' => 'checkbox', 'priority' => $priority++)); $wp_customize->add_setting('is_display_portfolio_tags', array('type' => 'theme_mod', 'default' => $defaults['is_display_portfolio_tags'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sgwindow_sanitize_checkbox')); $wp_customize->add_control('is_display_portfolio_tags', array('label' => __('Display Tag List', 'sg-window'), 'section' => 'layout_portfolio_page', 'settings' => 'is_display_portfolio_tags', 'type' => 'checkbox', 'priority' => $priority++)); }
?> </header><!-- .entry-header --> <?php if ('excerpt' == sgwindow_get_theme_mod('single_style') || 'content' == sgwindow_get_theme_mod('single_style') && is_search()) { ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php } elseif ('content' == sgwindow_get_theme_mod('single_style')) { ?> <div class="entry-content"> <?php the_content(__('<div class="meta-nav">Continue reading... →</div>', 'sg-diamond')); ?> </div><!-- .entry-content --> <?php } ?> <?php edit_post_link(__('Edit', 'sg-diamond'), '<span title="' . __('Edit', 'sg-diamond') . '" class="edit-link">', '</span>'); ?>
?> </header><!-- .entry-header --> <?php if ('excerpt' == sgwindow_get_theme_mod('portfolio_style')) { ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php } elseif ('content' == sgwindow_get_theme_mod('portfolio_style')) { ?> <div class="entry-content"> <?php the_content(); ?> </div><!-- .entry-content --> <?php } ?> <footer class="entry-meta"> <span class="project" title="<?php
<?php the_content(__('<div class="meta-nav">Read more... →</div>', 'sg-window')); ?> <?php wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'sg-window'), 'after' => '</div>')); ?> </div><!-- .entry-content --> <?php } ?> <div class="clear"></div> <footer class="entry-footer"> <div class="entry-meta"> <?php if ('1' == sgwindow_get_theme_mod('is_display_post_tags')) { ?> <div class="tags"> <?php echo get_the_tag_list('', ' '); ?> </div> <?php } ?> <span class="post-date"> <?php sgwindow_posted_on();
/** * Header image * * @since SG Window 1.1.0 */ function sgwindow_header_image() { if (get_header_image() && (sgwindow_get_theme_mod('is_header_on_front_page_only') != '1' || is_front_page())) { if ('1' != sgwindow_get_theme_mod('is_parallax_header')) { ?> <!-- Banner --> <div class="image-container"> <div class="image-wrapper"> <a href="<?php echo esc_url(home_url('/')); ?> "> <img src="<?php header_image(); ?> " class="header-image" width="<?php echo get_custom_header()->width; ?> " height="<?php echo get_custom_header()->height; ?> " alt="" /> </a> </div> </div> <?php } else { ?> <!-- Banner --> <a href="<?php echo esc_url(home_url('/')); ?> "> <div class="my-image widget"> <div class="parallax-image <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_speed')); ?> 0 0" style="background-image: url(<?php header_image(); ?> );"> </div><!-- .parallax-image --> </div><!-- .my-image --> </a> <?php } } }
/** * Widget output * * @since SG Window 1.0.0 * */ function widget($args, $instance) { if (!class_exists('WooCommerce')) { return; } // Widget output extract($args); $sidebar_id = isset($args['id']) ? $args['id'] : ''; // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); preg_match_all('!\\d+!', $instance['columns'], $matches); $width = $this->get_width($sidebar_id, absint(implode(' ', $matches[0])), $instance['padding_right'], $instance['padding_left']); $args = array(); $tax = 'product_cat'; global $post; $not_in = array(); if (is_singular()) { $not_in[] = $post->ID; } $not_in = array_merge($not_in, get_option('sticky_posts')); if ('0' != $instance['product_cat']) { $args = array(array('taxonomy' => $tax, 'terms' => array($instance['product_cat']), 'field' => 'term_id', 'operator' => 'IN')); } $query = new WP_Query(array('order' => 'DESC', 'posts_per_page' => $instance['count'], 'no_found_rows' => true, 'post_status' => 'publish', 'post__not_in' => $not_in, 'post_type' => 'product', 'tax_query' => $args)); if ($query->have_posts()) { $tmp_content_width = $GLOBALS['content_width']; $GLOBALS['content_width'] = $width; //print the widget for the sidebar echo $before_widget; if (trim($instance['title']) !== '') { echo $before_title . esc_html($instance['title']) . $after_title; } $pos_class = ''; if (0 != $instance['is_has_description']) { $pos_class = 1 == $instance['is_right'] ? ' right' : ' left'; } ?> <div class="woocommerce"> <div class="main-wrapper-image <?php echo $pos_class; ?> " style="padding:<?php echo esc_attr($instance['padding_top']); ?> px <?php echo esc_attr($instance['padding_right']); ?> % <?php echo esc_attr($instance['padding_bottom']); ?> px <?php echo esc_attr($instance['padding_left']); ?> %"> <?php if (0 != $instance['is_has_description'] && '0' != $instance['product_cat']) { ?> <div class="description"> <article> <header> <h3 class="main-title"><?php echo esc_html(get_term($instance['product_cat'], $tax)->name); ?> </h3> </header><!-- header --> <p><?php echo term_description($instance['product_cat'], $tax); ?> </p> <a href="<?php echo esc_url(get_term_link($instance['product_cat'], $tax)); ?> " class="link" rel="bookmark"><?php _e('All Products', 'sg-window'); ?> </a> </article> <!-- article --> </div> <!-- .description --> <?php } ?> <div class="wrapper-image <?php echo esc_attr($instance['columns']) . ($instance['is_step'] ? ' step' : ' all') . ($instance['is_hover_all'] ? ' hover-all' : '') . ($instance['is_margin_0'] ? ' margin-0' : ''); ?> "> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="element <?php echo esc_attr($instance['effect_id']) . ($instance['is_animate_once'] ? ' once' : '') . ($instance['is_animate'] ? ' animate' : ''); ?> "> <article> <?php if (has_post_thumbnail() && !post_password_required()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $instance['image_size']); } else { $image = sgwindow_get_theme_mod('empty_image'); } ?> <div class="entry-thumbnail" style="background-image:url('<?php echo $image[0]; ?> ')"> </div> <div class="hover"> <a href="<?php echo esc_url(get_permalink()); ?> " class="hover-a"> <header> <?php the_title('<h2><a class="entry-title" href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h2>'); ?> <?php woocommerce_get_template('loop/rating.php'); ?> </header><!-- header --> <p><?php sgwindow_the_excerpt(); ?> </p> </a> </div><!-- .hover --> <a href="<?php echo esc_url(get_permalink()); ?> " class="link" rel="bookmark"><?php echo esc_html($instance['link_caption']); ?> </a> <div class="product-price"> <?php woocommerce_get_template('loop/price.php'); ?> </div><!-- .project-list --> </article><!-- article --> </div><!-- .element --> <?php } $GLOBALS['content_width'] = $tmp_content_width; wp_reset_postdata(); ?> </div><!-- .wrapper --> <div class="hide-element"></div> </div><!-- .main-wrapper --> </div> <!-- .woocommerce --> <?php echo $after_widget; } }
<?php sgwindow_paging_nav(); ?> <div class="content-search"> <?php do_action('sgwindow_after_content'); ?> </div><!-- .content-search --> <?php } else { ?> <div class="content"> <?php get_template_part('content', 'none'); ?> </div><!-- .content --> <?php } ?> </div><!-- .site-content --> <?php sgwindow_get_sidebar(sgwindow_get_theme_mod('layout_archive')); ?> </div> <!-- .main-wrapper --> <?php get_footer();
/** * Return array Defaults * * @since SG Window 1.1.0 */ function defaults($instance) { $defaults = array('title' => '', 'count' => '4', 'speed' => sgwindow_get_theme_mod('slider_speed'), 'delay' => sgwindow_get_theme_mod('slider_delay'), 'is_play' => $instance == null ? sgwindow_get_theme_mod('slider_play') : '', 'empty' => get_template_directory_uri() . '/img/0.jpg', 'img_0' => get_template_directory_uri() . '/img/1.jpg', 'img_1' => get_template_directory_uri() . '/img/2.jpg', 'img_2' => get_template_directory_uri() . '/img/3.jpg', 'img_3' => get_template_directory_uri() . '/img/4.jpg', 'descr' => __('Description', 'sg-window'), 'link' => '#', 'is_link' => $instance == null ? '1' : '', 'height' => sgwindow_get_theme_mod('slider_height'), 'margin' => sgwindow_get_theme_mod('slider_margin'), 'text_color' => '#ffffff', 'content_type' => sgwindow_get_theme_mod('slider_content_type'), 'category' => '0', 'jetpack-portfolio-type' => '0', 'order' => 'date', 'image_size' => 'large', 'is_background' => $instance == null ? '1' : '', 'is_cat' => '', 'is_popular_pages' => ''); return $defaults; }
?> <div class="content-search"> <?php do_action('sgwindow_after_content'); ?> </div><!-- .content-search --> </div><!-- .content --> <div class="clear"></div> <?php sgwindow_paging_nav(); } else { ?> <div class="content"> <?php get_template_part('content', 'none'); ?> </div><!-- .content --> <div class="clear"></div> <?php } ?> </div><!-- .site-content --> <?php sgwindow_get_sidebar(sgwindow_get_theme_mod('layout_search')); ?> </div> <!-- .main-wrapper --> <?php get_footer();
if ('1' == sgwindow_get_theme_mod('is_show_footer_menu')) { ?> <div id="footer-navigation" class="nav-container"> <nav id="menu-4" class="horisontal-navigation" role="navigation"> <span class="toggle"><span class="menu-toggle"></span></span> <?php wp_nav_menu(array('theme_location' => 'footer', 'menu_class' => 'nav-horizontal')); ?> </nav><!-- #menu-4 .horisontal-navigation --> <div class="clear"></div> </div><!-- #footer-navigation .nav-container --> <?php } if ((!is_front_page() || '1' == sgwindow_get_theme_mod('is_home_footer')) && !is_page_template('page-templates/no-content-footer.php')) { get_sidebar('footer'); } ?> <footer id="colophon" class="site-footer"> <?php do_action('sgwindow_site_info'); ?> </footer><!-- #colophon --> </div><!-- #page --> <div class="background-fixed"></div> <div class="hide-screen-fixed"></div> <?php
/** * Add custom styles to the header. * * @since SG Window 1.0.0 */ function sgwindow_hook_css() { $defaults = sgwindow_get_defaults(); $position = sgwindow_column_dir(); $top = get_theme_mod('top', $defaults['top']); ?> <style type="text/css"> <?php if (!display_header_text()) { ?> .site-title, .site-description { clip: rect(1px 1px 1px 1px); /* IE7 */ clip: rect(1px, 1px, 1px, 1px); position: absolute; } <?php } ?> <?php if ('1' != sgwindow_get_theme_mod('blog_is_entry_meta')) { ?> .flex .entry-meta, .flex .entry-meta a { font-size: 0; } <?php } else { ?> .flex .entry-meta, .flex .entry-meta a { font-size: 12px; } <?php } ?> .site-title h1, .site-title a { color: #<?php echo esc_attr(get_header_textcolor()); ?> ; } .background-fixed { bckground: repeat <?php echo esc_attr($top); ?> center fixed; background-image: url(<?php echo esc_url(sgwindow_get_theme_mod('column_background_url')); ?> ); } .site-content { -ms-flex-order: <?php echo $position['content']; ?> ; -webkit-order: <?php echo $position['content']; ?> ; order: <?php echo $position['content']; ?> ; } .sidebar-1 { -ms-flex-order: <?php echo $position['column-1']; ?> ; -webkit-order: <?php echo $position['column-1']; ?> ; order: <?php echo $position['column-1']; ?> ; } .sidebar-2 { -ms-flex-order: <?php echo $position['column-2']; ?> ; -webkit-order: <?php echo $position['column-2']; ?> ; order: <?php echo $position['column-2']; ?> ; } <?php if ('1' != sgwindow_get_theme_mod('is_mobile_column_1')) { ?> .sidebar-1 { display: none; } <?php } if ('1' != sgwindow_get_theme_mod('is_mobile_column_2')) { ?> .sidebar-2 { display: none; } <?php } ?> .sidebar-before-footer, .header-wrap { max-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_image')); ?> px; } .sidebar-before-footer, .header-wrap, .site { max-width: <?php echo esc_attr(get_theme_mod('width_site', $defaults['width_site'])); ?> px; } .main-wrapper.no-sidebar { max-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_content_no_sidebar')); ?> px; } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('size_image')); ?> px) { .image-wrapper { max-width: <?php echo esc_attr(sgwindow_get_theme_mod('size_image')); ?> px; } } .sidebar-footer .widget-area, .wide .widget > input, .wide .widget > form, .sidebar-before-footer .widget > div, .sidebar-before-footer .widget-area .widget > ul, .sidebar-top-full .widget-area .widget > div, .sidebar-top-full .widget-area .widget > ul { max-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_top_widget_area')); ?> px; margin-left: auto; margin-right: auto; } .site .wide .widget-area .main-wrapper.no-sidebar { margin: 0 auto; max-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper')); ?> px; } .sidebar-footer .widget-area, .wide .widget > input, .wide .widget > form, .sidebar-before-footer .widget > div, .sidebar-before-footer .widget-area .widget > ul, .sidebar-top-full .widget-area .widget > div, .sidebar-top-full .widget-area .widget > ul, .widget.sgwindow_side_bar .widget-title, .widget.sgwindow_side_bar .widgettitle, .text-container, .main-wrapper { max-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper')); ?> px; } .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height') / 4); ?> px; } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper') / 3.5); ?> px) { .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height') / 3.5); ?> px; } } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper') / 3); ?> px) { .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height') / 3); ?> px; } } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper') / 2.5); ?> px) { .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height') / 2.5); ?> px; } } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper') / 2); ?> px) { .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height') / 2); ?> px; } } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper') / 1.5); ?> px) { .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height') / 1.5); ?> px; } } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper') / 1.2); ?> px) { .my-image { height: <?php echo esc_attr(sgwindow_get_theme_mod('parallax_image_height')); ?> px; } } /* set width of column in px */ @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_mobile_switch')); ?> px) { .content { -ms-flex-order: 1; -webkit-order: 1; order: 1; } .sidebar-1 { -ms-flex-order: 2; -webkit-order: 2; order: 2; } .sidebar-2 { -ms-flex-order: 3; -webkit-order: 3; order: 3; } .main-wrapper { -webkit-flex-flow: nowrap; -ms-flex-flow: nowrap; flex-flow: nowrap; } .sidebar-1, .sidebar-2 { display: block; } .sidebar-1 .column { padding: 0 20px 0 0; } .sidebar-2 .column { padding: 0 0 0 20px; } .site-content { -ms-flex-order: 2; -webkit-order: 2; order: 2; } .sidebar-1 { -ms-flex-order: 1; -webkit-order: 1; order: 1; } .sidebar-2 { -ms-flex-order: 3; -webkit-order: 3; order: 3; } .two-sidebars .sidebar-1 { width: <?php echo esc_attr(sgwindow_get_theme_mod('width_column_1_rate')); ?> %; } .two-sidebars .sidebar-2 { width: <?php echo esc_attr(sgwindow_get_theme_mod('width_column_2_rate')); ?> %; } .two-sidebars .site-content { width: <?php echo esc_attr(100 - sgwindow_get_theme_mod('width_column_2_rate') - sgwindow_get_theme_mod('width_column_1_rate')); ?> %; } .left-sidebar .sidebar-1 { width: <?php echo esc_attr(sgwindow_get_theme_mod('width_column_1_left_rate')); ?> %; } .left-sidebar .site-content { width: <?php echo esc_attr(100 - sgwindow_get_theme_mod('width_column_1_left_rate')); ?> %; } .right-sidebar .sidebar-2 { width: <?php echo esc_attr(sgwindow_get_theme_mod('width_column_1_right_rate')); ?> %; } .right-sidebar .site-content { width: <?php echo esc_attr(100 - sgwindow_get_theme_mod('width_column_1_right_rate')); ?> %; } /* widget-sidebar */ .sidebar-footer-content, .site .widget-sidebar-wrapper { -webkit-flex-flow: nowrap; -ms-flex-flow: nowrap; flex-flow: nowrap; } .my-sidebar-layout { margin: 20px 20px 20px 0; border: 1px solid #ccc; } .my-sidebar-layout:first-child { margin: 20px; } } @media screen and (min-width: <?php echo esc_attr(sgwindow_get_theme_mod('width_main_wrapper')); ?> px) { /* image widget */ .wide .small.flex-column-2 .column-4 .element .entry-title, .wide .small.flex-column-2 .column-4 .element p, .wide .small.flex-column-2 .column-4 .element a, .wide .small.flex-column-2 .column-3 .element .entry-title, .wide .small.flex-column-2 .column-3 .element p, .wide .small.flex-column-2 .column-3 .element a { font-size: 14px; } .wide .small.flex-column-2 .column-2 .element .entry-title, .wide .small.flex-column-2 .column-1 .element .entry-title { display: block; font-size: 14px; } .wide .small.flex-column-2 .column-2 .element p, .wide .small.flex-column-2 .column-2 .element a, .wide .small.flex-column-2 .column-1 .element p, .wide .small.flex-column-2 .column-1 .element a { display: block; font-size: 14px; } .wide .small.flex-column-4 .column-2 .element .entry-title, .wide .small.flex-column-4 .column-1 .element .entry-title, .wide .small.flex-column-3 .column-2 .element .entry-title, .wide .small.flex-column-3 .column-2 .element .entry-title, .wide .small.flex-column-2 .column-2 .element .entry-title, .wide .small.flex-column-2 .column-1 .element .entry-title { display: block; font-size: 14px; } .wide .small.flex-column-4 .column-2 .element p, .wide .small.flex-column-4 .column-1 .element p, .wide .small.flex-column-3 .column-2 .element p, .wide .small.flex-column-3 .column-1 .element p { display: block; font-size: 12px; } .wide .small.flex-column-1 .column-4 .element .entry-title, .wide .small.flex-column-1 .column-3 .element .entry-title, .wide .small.flex-column-1 .column-4 .element .link, .wide .small.flex-column-1 .column-3 .element .link, .wide .small.flex-column-1 .column-4 .element p, .wide .small.flex-column-1 .column-3 .element p { font-size: 16px; } .wide .small.flex-column-1 .column-2 .element .entry-title, .wide .small.flex-column-1 .column-1 .element .entry-title, .wide .small.flex-column-1 .column-2 .element .link, .wide .small.flex-column-1 .column-1 .element .link, .wide .small.flex-column-1 .column-2 .element p, .wide .small.flex-column-1 .column-1 .element p { font-size: 18px; } .my-sidebar-layout { margin: 20px 20px 20px 0; border: 1px solid #ccc; } .my-sidebar-layout:first-child { margin: 20px 20px 20px 0; } .my-sidebar-layout:last-child { margin: 20px 0 20px 0; } } } </style> <?php }
/** * Archive Meta. * * @since SG Diamond 1.0.0 */ function sgwindow_posted_on() { $is_author = is_singular() ? '1' == sgwindow_get_theme_mod('is_author') ? true : false : ('1' == sgwindow_get_theme_mod('blog_is_author') ? true : false); $is_date = is_singular() ? '1' == sgwindow_get_theme_mod('is_date') ? true : false : ('1' == sgwindow_get_theme_mod('blog_is_date') ? true : false); $is_views = is_singular() ? '1' == sgwindow_get_theme_mod('is_views') ? true : false : ('1' == sgwindow_get_theme_mod('blog_is_views') ? true : false); $views = null; if ($is_views) { if ('1' == sgwindow_get_theme_mod('is_views')) { if (class_exists('Jetpack') && Jetpack::is_module_active('stats') && function_exists('stats_get_csv')) { $result = stats_get_csv('postviews', 'post_id=' . get_the_ID() . '&limit=-1&summarize'); $views = '<span class="post-views">' . esc_attr(number_format_i18n($result[0]['views'])) . '</span>'; } } } if ('1' == sgwindow_get_theme_mod('is_cat') && (is_home() || is_archive() || is_search())) { $categories = get_the_category(get_the_ID()); if (!empty($categories)) { echo '<a href="' . esc_url(get_category_link($categories[0]->term_id)) . '"><span class="post-cat' . ($is_date || isset($views) || $is_author ? ' post-sep' : '') . '">' . esc_attr($categories[0]->name) . '</span>'; } } if ($is_author) { echo '<a href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '"><span class="post-author' . ($is_date || isset($views) ? ' post-sep' : '') . '">' . esc_attr(get_the_author()) . '</span></a>'; } if ($is_date) { echo '<a href="' . esc_url(get_permalink()) . '"><span class="post-date' . (isset($views) ? ' post-sep' : '') . '">' . esc_attr(get_the_date()) . '</span></a>'; } if (isset($views)) { echo $views; } }
<div class="content-search"> <?php do_action('sgwindow_after_content'); ?> </div><!-- .content-search --> </div><!-- .content --> <div class="clear"></div> <?php sgwindow_paging_nav(); } else { ?> <div class="content"> <?php get_template_part('content', 'none'); ?> </div><!-- .content --> <?php } ?> </div><!-- .site-content --> <?php sgwindow_get_sidebar(sgwindow_get_theme_mod('layout_home')); ?> </div> <!-- .main-wrapper --> <?php } get_footer();
<?php /** * The template for displaying woocommerce archive pages. * * @package WordPress * @subpackage sgwindow * @since SG Window 1.0.0 */ get_header(); $sgwindow_layout_name = is_shop() || is_archive() ? 'layout_shop' : 'layout_shop-page'; $sgwindow_layout = sgwindow_get_theme_mod($sgwindow_layout_name); global $woocommerce_loop; $sgwindow_columns = 4; if (!empty($woocommerce_loop['columns'])) { $sgwindow_columns = apply_filters('loop_shop_columns', 4); } if (is_singular()) { $sgwindow_columns = 0; } ?> <div class="main-wrapper woo-shop <?php echo esc_attr($sgwindow_layout); ?> flex-layout-<?php echo esc_attr($sgwindow_columns); ?> "> <div class="site-content">
/** * Widget output * * @since SG Window 1.0.0 * */ function widget($args, $instance) { // Widget output extract($args); $sidebar_id = isset($args['id']) ? $args['id'] : ''; // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); $width = $this->get_width($sidebar_id, 2); /* save current page id in global variable, use it in sidebar-X-widget.php */ global $sgwindow_curr_page_id; $sgwindow_curr_page_id = $instance['page_id']; $query = new WP_Query(array('order' => 'DESC', 'posts_per_page' => 1, 'no_found_rows' => true, 'post_status' => 'publish', 'post__in' => array($sgwindow_curr_page_id), 'post_type' => 'page')); if ($query->have_posts()) { $tmp_content_width = $GLOBALS['content_width']; $GLOBALS['content_width'] = $width; //print the widget for the sidebar //print the widget for the sidebar echo $args['before_widget']; $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); if ('' !== trim($instance['title'])) { echo $before_title . esc_html($instance['title']) . $after_title; } ?> <div class="widget-page-wrap <?php echo '1' == $instance['is_centered'] ? 'centered' : ''; ?> <?php echo '1' == $instance['is_transparent'] ? 'transparent' : ''; ?> "> <div class="main-wrapper <?php echo esc_attr($instance['layout']); ?> "> <?php sgwindow_get_sidebar_widget($instance['layout']); $query->the_post(); ?> <div class="site-content"> <div class="content"> <div class="content-container"> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <header class="entry-header"> <?php if ('1' != $instance['is_no_title']) { the_title('<h1 class="entry-title">', '</h1>'); } ?> <?php if (has_post_thumbnail() && '1' == sgwindow_get_theme_mod('is_display_page_image')) { ?> <div class="entry-thumbnail"> <?php the_post_thumbnail(); ?> </div> <?php } ?> </header><!-- .entry-header --> <div class="entry-content"> <?php the_content(); ?> </div><!-- .entry-content --> <?php edit_post_link(__('Edit', 'sg-window'), '<span title="' . __('Edit', 'sg-window') . '" class="edit-link">', '</span>'); ?> </div><!-- #post-## --> </div><!-- .content-container --> </div><!-- .content --> <div class="clear"></div> </div><!-- .site-content --> </div> <!-- .main-wrapper --> </div> <!-- .widget-page-wrap --> <?php echo $args['after_widget']; wp_reset_postdata(); $GLOBALS['content_width'] = $tmp_content_width; } }