/** * Adds body classes for special theme features. * * @since 1.0.0 * * @param $classes * * @return array */ function themify_theme_body_class($classes) { // Add transparent-header class to body if user selected it in custom panel if ((is_single() || is_page()) && 'transparent' == themify_get('header_wrap')) { $classes[] = 'transparent-header'; } // Header Design $header = themify_area_design('header', array('default' => '', 'values' => wp_list_pluck(themify_theme_header_design_options(), 'value'))); $classes[] = 'none' == $header ? 'header-none' : $header; $classes[] = themify_theme_fixed_header() ? 'fixed-header' : 'no-fixed-header'; if ('header-block' == $header && 'yes' == themify_theme_get('full_height_header')) { $classes[] = 'header-full-height'; } // Footer Design $footer = themify_area_design('footer', array('default' => '', 'values' => wp_list_pluck(themify_theme_footer_design_options(), 'value'))); $classes[] = 'none' == $footer ? 'footer-none' : $footer; // Theme Color $color = themify_area_design('color', array('default' => '', 'values' => wp_list_pluck(themify_theme_color_design_options(), 'value'))); $classes[] = $color; // Typography $font = themify_area_design('font', array('default' => '', 'values' => wp_list_pluck(themify_theme_font_design_options(), 'value'))); $classes[] = $font; // Exclusion classes if (!themify_theme_show_area('site_logo')) { $classes[] = 'logo-off'; } if (!themify_theme_show_area('site_tagline')) { $classes[] = 'tagline-off'; } if (!themify_theme_show_area('social_widget')) { $classes[] = 'social-widget-off'; } if (!themify_theme_show_area('rss')) { $classes[] = 'rss-off'; } if (!themify_theme_show_area('search_form')) { $classes[] = 'search-off'; } if (!themify_theme_show_area('menu_navigation')) { $classes[] = 'menu-navigation-off'; } if (!themify_theme_show_area('footer')) { $classes[] = 'footer-off'; } if (!themify_theme_show_area('header_widgets')) { $classes[] = 'header-widgets-off'; } if (!themify_theme_show_area('footer_widgets')) { $classes[] = 'footer-widgets-off'; } if (!themify_theme_show_area('footer_menu_navigation')) { $classes[] = 'footer-menu-navigation-off'; } // Image Filters $filter = ''; $filter_hover = ''; $apply_to = ''; if (is_page()) { if ($do_filter = themify_get('imagefilter_options')) { if ('initial' != $do_filter) { $filter = 'filter-' . $do_filter; } } if ($do_hover_filter = themify_get('imagefilter_options_hover')) { if ('initial' != $do_hover_filter) { $filter_hover = 'filter-hover-' . $do_hover_filter; } } if ($apply_here = themify_get('imagefilter_applyto')) { if ('initial' != $apply_here) { $apply_to = 'filter-' . $apply_here; } } } elseif (is_singular()) { if ($do_filter = themify_get('imagefilter_options')) { if ('initial' != $do_filter) { $filter = 'filter-' . $do_filter; } } if ($do_hover_filter = themify_get('imagefilter_options_hover')) { if ('initial' != $do_hover_filter) { $filter_hover = 'filter-hover-' . $do_hover_filter; } } if ($apply_here = themify_get('imagefilter_applyto')) { if ('initial' != $apply_here) { $apply_to = 'filter-' . $apply_here; } } } if ('' == $filter) { if ($do_filter = themify_get('setting-imagefilter_options')) { $filter = 'filter-' . $do_filter; } } if ('' == $filter_hover) { if ($do_hover_filter = themify_get('setting-imagefilter_options_hover')) { $filter_hover = 'filter-hover-' . $do_hover_filter; } else { $filter_hover = 'filter-hover-none'; } } if ('' == $apply_to) { if ('' != $filter || '' != $filter_hover) { if ('allimages' == themify_get('setting-imagefilter_applyto')) { $apply_to = 'filter-all'; } else { $apply_to = 'filter-featured-only'; } } } $classes[] = $filter; $classes[] = $filter_hover; $classes[] = $apply_to; // Check if masonry is enabled $classes[] = themify_theme_is_masonry_enabled(); // Skin Styles if ('' != themify_get('body_background_color') || '' != themify_get('body_background_image') || '' != themify_get('body_font') || '' != themify_get('body_text_color') || '' != themify_get('body_link_color') || '' != themify_get('heading_font') || '' != themify_get('heading_color') || '' != themify_get('scheme_background') || '' != themify_get('scheme_color')) { $classes[] = 'skin-styles'; } return $classes; }
/** * Markup for theme design options * @param array $data * @return string */ function themify_theme_design_controls($data = array()) { /** * Module markup * @var string */ $html = ''; /** * Theme Color * @var array */ $design_options = themify_theme_color_design_options(); /** * Prefix for theme settings * @var string */ $pre = 'setting-color_design'; /** * Theme Color */ $html .= '<p> <span class="label">' . __('Theme Color', 'themify') . '</span>'; $val = themify_check($pre) ? themify_get($pre) : ''; foreach ($design_options as $option) { if (('' == $val || !$val) && $option['selected']) { $val = $option['value']; } $class = $val == $option['value'] ? 'selected' : ''; $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '" /></a>'; } $html .= ' <input type="hidden" name="' . esc_attr($pre) . '" class="val" value="' . esc_attr($val) . '" /> </p>'; /** * Typography * @var array */ $design_options = themify_theme_font_design_options(); /** * Prefix for theme settings * @var string */ $pre = 'setting-font_design'; /** * Typography */ $html .= '<p> <span class="label">' . __('Typography', 'themify') . '</span>'; $val = themify_check($pre) ? themify_get($pre) : ''; foreach ($design_options as $option) { if (('' == $val || !$val) && $option['selected']) { $val = $option['value']; } $class = $val == $option['value'] ? 'selected' : ''; $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '" /></a>'; } $html .= ' <input type="hidden" name="' . esc_attr($pre) . '" class="val" value="' . esc_attr($val) . '" /> </p>'; /** * Header Design * @var array */ $design_options = themify_theme_header_design_options(); /** * Prefix for theme settings * @var string */ $pre = 'setting-header_design'; // Store items to hide $html .= '<div class="group-hide" data-hide="none header-leftpane header-minbar boxed-content">'; /** * Header Design */ $html .= '<p> <span class="label">' . __('Header Design', 'themify') . '</span>'; $val = themify_check($pre) ? themify_get($pre) : ''; foreach ($design_options as $option) { if (('' == $val || !$val) && isset($option['selected']) && $option['selected']) { $val = $option['value']; } $class = $val == $option['value'] ? 'selected' : ''; $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '" /></a>'; } $html .= ' <input type="hidden" name="' . esc_attr($pre) . '" class="val" value="' . esc_attr($val) . '" /> </p>'; /** * Fixed header */ $html .= sprintf('<p class="hide-if none header-leftpane header-minbar boxed-content pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-fixed_header_disabled', checked(themify_get('setting-fixed_header_disabled'), 'on', false), __('Disable Sticky Header.', 'themify')); /** * Full height header */ $key = 'setting-full_height_header'; $html .= sprintf('<p class="hide-if none header-horizontal header-leftpane header-minbar boxed-layout boxed-content pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s value="yes"/> %3$s</label> <br><small>%4$s</small> </p>', $key, checked(themify_get($key), 'yes', false), __('Full Height Header.', 'themify'), __('Full height will display the container in 100% viewport height', 'themify')); /** * Exclude Site Logo */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_site_logo', checked(themify_get('setting-exclude_site_logo'), 'on', false), __('Exclude Site Logo.', 'themify')); /** * Exclude Site Tagline */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_site_tagline', checked(themify_get('setting-exclude_site_tagline'), 'on', false), __('Exclude Site Tagline.', 'themify')); /** * Exclude Search Form */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_search_form', checked(themify_get('setting-exclude_search_form'), 'on', false), __('Exclude Search Form.', 'themify')); /** * Exclude RSS Link */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_rss', checked(themify_get('setting-exclude_rss'), 'on', false), __('Exclude RSS Link.', 'themify')); /** * Exclude Header Widgets */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_header_widgets', checked(themify_get('setting-exclude_header_widgets'), 'on', false), __('Exclude Header Widgets.', 'themify')); /** * Exclude Social Widgets */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_social_widget', checked(themify_get('setting-exclude_social_widget'), 'on', false), __('Exclude Social Widgets.', 'themify')); /** * Exclude Menu Navigation */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_menu_navigation', checked(themify_get('setting-exclude_menu_navigation'), 'on', false), __('Exclude Menu Navigation.', 'themify')); // End group of elements to hide $html .= '</div><!-- /.group-hide -->'; /** * Header Widgets */ $options = array(array('value' => 'headerwidget-4col', 'img' => 'themify/img/sidebars/4col.png', 'title' => __('Widgets 4 Columns', 'themify')), array('value' => 'headerwidget-3col', 'img' => 'themify/img/sidebars/3col.png', 'title' => __('Widgets 3 Columns', 'themify'), 'selected' => true), array('value' => 'headerwidget-2col', 'img' => 'themify/img/sidebars/2col.png', 'title' => __('Widgets 2 Columns', 'themify')), array('value' => 'headerwidget-1col', 'img' => 'themify/img/sidebars/1col.png', 'title' => __('Widgets 1 Column', 'themify')), array('value' => 'none', 'img' => 'themify/img/sidebars/none.png', 'title' => __('No Widgets', 'themify'))); $val = themify_get('setting-header_widgets'); $html .= '<p> <span class="label">' . __('Header Widgets', 'themify') . '</span>'; foreach ($options as $option) { if (('' == $val || !$val || !isset($val)) && isset($option['selected']) && $option['selected']) { $val = $option['value']; } if ($val == $option['value']) { $class = 'selected'; } else { $class = ''; } $html .= '<a href="#" class="' . esc_attr('preview-icon ' . $class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '" /></a>'; } $html .= '<input type="hidden" name="setting-header_widgets" class="val" value="' . esc_attr($val) . '" />'; $html .= '</p>'; /** * Footer Design * @var array */ $design_options = themify_theme_footer_design_options(); /** * Prefix for theme settings * @var string */ $key = 'setting-footer_design'; // Store items to hide $html .= '<div class="group-hide" data-hide="none">'; /** * Footer Design */ $html .= '<p> <span class="label">' . __('Footer Design', 'themify') . '</span>'; $val = themify_check($key) ? themify_get($key) : ''; foreach ($design_options as $option) { if (('' == $val || !$val) && $option['selected']) { $val = $option['value']; } $class = $val == $option['value'] ? 'selected' : ''; $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '" /></a>'; } $html .= ' <input type="hidden" name="' . esc_attr($key) . '" class="val" value="' . esc_attr($val) . '" /> </p>'; // Exclusions $key = 'setting-exclude_'; /** * Exclude Site Logo */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_site_logo', checked(themify_get($key . 'footer_site_logo'), 'on', false), __('Exclude Site Logo.', 'themify')); /** * Exclude Footer Widgets */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_widgets', checked(themify_get($key . 'footer_widgets'), 'on', false), __('Exclude Footer Widgets.', 'themify')); /** * Exclude Menu Navigation */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_menu_navigation', checked(themify_get($key . 'footer_menu_navigation'), 'on', false), __('Exclude Menu Navigation.', 'themify')); /** * Exclude Footer Texts */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_texts', checked(themify_get($key . 'footer_texts'), 'on', false), __('Exclude Footer Text', 'themify')); /** * Exclude Footer Back to Top */ $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_back', checked(themify_get($key . 'footer_back'), 'on', false), __('Exclude Back to Top button', 'themify')); // End group of elements to hide $html .= '</div><!-- /.group-hide -->'; $options = array(array('value' => 'footerwidget-4col', 'img' => 'themify/img/sidebars/4col.png', 'title' => __('Widgets 4 Columns', 'themify')), array('value' => 'footerwidget-3col', 'img' => 'themify/img/sidebars/3col.png', 'title' => __('Widgets 3 Columns', 'themify'), 'selected' => true), array('value' => 'footerwidget-2col', 'img' => 'themify/img/sidebars/2col.png', 'title' => __('Widgets 2 Columns', 'themify')), array('value' => 'footerwidget-1col', 'img' => 'themify/img/sidebars/1col.png', 'title' => __('Widgets 1 Column', 'themify')), array('value' => 'none', 'img' => 'themify/img/sidebars/none.png', 'title' => __('No Widgets', 'themify'))); $val = themify_get('setting-footer_widgets'); $html .= '<p> <span class="label">' . __('Footer Widgets', 'themify') . '</span>'; foreach ($options as $option) { if (('' == $val || !$val || !isset($val)) && isset($option['selected']) && $option['selected']) { $val = $option['value']; } if ($val == $option['value']) { $class = 'selected'; } else { $class = ''; } $html .= '<a href="#" class="' . esc_attr('preview-icon ' . $class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '" /></a>'; } $html .= '<input type="hidden" name="setting-footer_widgets" class="val" value="' . esc_attr($val) . '" />'; $html .= '</p>'; return $html; }