Ejemplo n.º 1
0
 /**
  * Generates semantic classes for BODY element
  *
  * @param array $classes body classes
  */
 function seamless_body_class($classes)
 {
     /**
      * Filter to control the theme layout
      *
      * Accepts any string that is part of seamless_available_theme_layouts(). Note that
      * the filter overrides the layout defined in the Theme Customizer. Any invalid
      * layout string will be ignored and the theme's default layout will be used.
      *
      * @see seamless_available_theme_layouts()
      *
      * @since 2.0
      *
      * @param string $current_layout
      */
     $current_layout = apply_filters('seamless_current_theme_layout', seamless_get_theme_opt('layout'));
     if (is_page_template('template-page-fullwidth.php')) {
         $classes[] = 'full-width';
     } elseif (in_array($current_layout, seamless_available_layout_slugs())) {
         $classes[] = $current_layout;
     } else {
         $classes[] = seamless_default_theme_layout();
     }
     /**
      * Filter the body classes
      * 
      * @param array $classes
      */
     return apply_filters('seamless_body_class', $classes);
 }
Ejemplo n.º 2
0
/**
 * Get the standard sidebar
 *
 * This includes the primary and secondary widget areas. 
 * The sidebar can be switched on or off using seamless_sidebar. <br>
 * Default: ON <br>
 * 
 * Filter: seamless_sidebar
 */
function seamless_sidebar()
{
    $current_layout = apply_filters('seamless_current_theme_layout', seamless_get_theme_opt('layout'));
    if (in_array($current_layout, seamless_available_layout_slugs()) && 'full-width' == $current_layout) {
        $show = false;
    } else {
        $show = true;
    }
    $show = apply_filters('seamless_sidebar', $show);
    if ($show) {
        get_sidebar();
    }
    return;
}
Ejemplo n.º 3
0
 function seamless_validate_opt($input)
 {
     $output = seamless_get_wp_opt('seamless_theme_opt', seamless_default_opt());
     // Author Info CheckBox value either 1(yes) or 0(no)
     $output['author_info'] = isset($input['author_info']) && 1 == $input['author_info'] ? 1 : 0;
     // Footer Text sanitized allowing HTML and WP shortcodes
     if (isset($input['footer_txt'])) {
         $output['footer_txt'] = wp_kses_post($input['footer_txt']);
     }
     // Check and set layout
     if (isset($input['layout'])) {
         $available_layouts = seamless_available_layout_slugs();
         if (in_array($input['layout'], $available_layouts)) {
             $output['layout'] = $input['layout'];
         } else {
             $output['layout'] = seamless_default_theme_layout();
         }
     }
     return apply_filters('seamless_theme_opt_validation', $output, $input);
 }
Ejemplo n.º 4
0
/**
 * Decide the default layout of the theme
 *
 * @since 2.0
 *
 * @return string $default_layout
 */
function seamless_default_theme_layout()
{
    // use a default layout of right-sidebar if no theme option has been set
    $seamless_default_layout = seamless_get_theme_opt('layout') ? seamless_get_theme_opt('layout') : 'right-sidebar';
    /**
     * Filter for the default layout
     *
     * Specifies the theme layout upon first setup. The returned string need to match 
     * one of the available layout slugs. Any invalid slug will be ignored.
     *
     * @since 2.0
     *
     * @see seamless_available_layout_slugs()
     *
     * @param string $seamless_default_layout
     */
    $seamless_possible_default_layout = apply_filters('seamless_default_theme_layout', $seamless_default_layout);
    // only use the filtered layout if it is a valid layout
    if (in_array($seamless_possible_default_layout, seamless_available_layout_slugs())) {
        $seamless_default_layout = $seamless_possible_default_layout;
    }
    return $seamless_default_layout;
}