function cherry_add_body_control_classes($classes, $class)
{
    // Responsive.
    if ('true' == cherry_get_option('grid-responsive')) {
        $classes[] = 'cherry-responsive';
    } else {
        $classes[] = 'cherry-no-responsive';
    }
    // Sidebar.
    if (cherry_display_sidebar(apply_filters('cherry_get_main_sidebar', 'sidebar-main'))) {
        $classes[] = 'cherry-with-sidebar';
    } else {
        $classes[] = 'cherry-no-sidebar';
    }
    // Navigation Arrow.
    if ('true' == cherry_get_option('navigation-arrow')) {
        $classes[] = 'cherry-navigation-arrow';
    }
    return $classes;
}
Example #2
0
/**
 * Display a site content wrapper.
 *
 * @since  4.0.0
 * @return string HTML-markup for content.
 */
function cherry_content_wrap()
{
    if (!did_action('cherry_content')) {
        $wrapper = '';
        if (false !== cherry_display_sidebar(apply_filters('cherry_get_main_sidebar', 'sidebar-main'))) {
            $layout = cherry_current_page()->get_property('layout');
            $class = sanitize_html_class($layout . '-wrapper');
            /**
             * Filter a CSS-class for site content wrapper.
             *
             * @since 4.0.0
             * @param $class CSS-class for content wrapper.
             */
            $wrapper_class = apply_filters('cherry_content_sidebar_wrapper_class', $class);
            $wrapper = sprintf('<div class="%s">', $wrapper_class);
        }
        printf('%1$s<div id="primary" class="content-area"><main %2$s>', $wrapper, cherry_get_attr('main'));
    } else {
        echo '</main></div>';
    }
}
Example #3
0
/**
 * Output Primary Content Wrap.
 *
 * @since 4.0.0
 */
function cherry_content_wrap()
{
    if (!did_action('cherry_content')) {
        $wrapper = '';
        if (false !== cherry_display_sidebar(apply_filters('cherry_get_main_sidebar', 'sidebar-main'))) {
            $object_id = apply_filters('cherry_current_object_id', get_queried_object_id());
            $layout = apply_filters('cherry_get_page_layout', get_post_meta($object_id, 'cherry_layout', true));
            if (empty($layout) || 'default-layout' == $layout) {
                if (is_single()) {
                    $layout = apply_filters('cherry_get_single_post_layout', cherry_get_option('single-post-layout'), $object_id);
                } else {
                    $layout = cherry_get_option('page-layout');
                }
            }
            $class = sanitize_html_class($layout . '-wrapper');
            $wrapper_class = apply_filters('cherry_content_sidebar_wrapper_class', $class);
            $wrapper = sprintf('<div class="%s">', $wrapper_class);
        }
        printf('%1$s<div id="primary" class="content-area"><main %2$s>', $wrapper, cherry_get_attr('main'));
    } else {
        echo '</main></div>';
    }
}
Example #4
0
/**
 * Loads template for sidebar by $name.
 *
 * @author Justin Tadlock <*****@*****.**>
 * @author Cherry Team <*****@*****.**>
 * @since  4.0.0
 * @param  string $name
 */
function cherry_get_sidebar($name = null)
{
    do_action('get_sidebar', $name);
    // Core WordPress hook.
    $name = (string) $name;
    if (false === cherry_display_sidebar($name)) {
        return;
    }
    $_name = $name . '-' . cherry_template_base();
    $templates = array();
    $templates[] = "{$_name}.php";
    $templates[] = "sidebar/{$_name}.php";
    $templates[] = "{$name}.php";
    $templates[] = "sidebar/{$name}.php";
    $templates[] = 'sidebar.php';
    $templates[] = 'sidebar/sidebar.php';
    $template_path = locate_template($templates);
    if ('' !== $template_path) {
        load_template($template_path);
        return;
    }
    // Backward compat (when template not found).
    do_action('cherry_sidebar_before', $name);
    printf('<div %s>', cherry_get_attr('sidebar', $name));
    if (is_active_sidebar("{$name}")) {
        dynamic_sidebar("{$name}");
    } else {
        do_action('cherry_sidebar_empty', $name);
    }
    echo '</div>';
    do_action('cherry_sidebar_after', $name);
}
Example #5
0
/**
 * Loads template for sidebar by $name.
 *
 * @author Justin Tadlock <*****@*****.**>
 * @author Cherry Team <*****@*****.**>
 * @since 4.0.0
 * @param string $name The name of the specialised sidebar.
 */
function cherry_get_sidebar($name = null)
{
    do_action('get_sidebar', $name);
    // Core WordPress hook.
    $name = (string) $name;
    if (false === cherry_display_sidebar($name)) {
        return;
    }
    $_name = $name . '-' . cherry_template_base();
    $templates = array();
    $templates[] = "{$_name}.php";
    $templates[] = "sidebar/{$_name}.php";
    $templates[] = "{$name}.php";
    $templates[] = "sidebar/{$name}.php";
    $templates[] = 'sidebar.php';
    $templates[] = 'sidebar/sidebar.php';
    $template_path = locate_template($templates);
    if ('' !== $template_path) {
        load_template($template_path);
        return;
    }
    /**
     * Fires before sidebar wrapper are opened.
     *
     * @since 4.0.0
     * @param string $name The name of the specialised sidebar.
     */
    do_action('cherry_sidebar_before', $name);
    printf('<div %s>', cherry_get_attr('sidebar', $name));
    if (is_active_sidebar("{$name}")) {
        dynamic_sidebar("{$name}");
    } else {
        /**
         * Fires if sidebar are empty.
         *
         * @since 4.0.0
         * @param string $name The name of the specialised sidebar.
         */
        do_action('cherry_sidebar_empty', $name);
    }
    echo '</div>';
    /**
     * Fires after sidebar wrapper are closed.
     *
     * @since 4.0.0
     * @param string $name The name of the specialised sidebar.
     */
    do_action('cherry_sidebar_after', $name);
}