Example #1
0
function bench_index_setup_document()
{
    //Layout
    if (beans_get_layout() == 'c') {
        beans_remove_attribute('beans_primary', 'class', 'uk-width-large-7-10');
    }
    // Posts grid
    beans_add_attribute('beans_content', 'class', 'tm-posts-grid uk-grid uk-grid-width-small-1-2 uk-grid-width-medium-1-3');
    beans_add_attribute('beans_content', 'data-uk-grid-margin', '');
    beans_add_attribute('beans_content', 'data-uk-grid-match', "{target:'.uk-panel'}");
    beans_wrap_inner_markup('beans_post', 'bench_post_panel', 'div', array('class' => 'uk-panel uk-panel-box'));
    // Post content
    beans_remove_attribute('beans_content', 'class', 'tm-centered-content');
    // Post article
    beans_remove_attribute('beans_post', 'class', 'uk-article');
    // Post meta
    beans_remove_action('beans_post_meta');
    beans_remove_action('beans_post_meta_tags');
    beans_modify_action('beans_post_meta_categories', 'beans_post_header', null, 7);
    beans_remove_output('beans_post_meta_categories_prefix');
    beans_add_attribute('beans_post_meta_categories', 'class', 'tm-post-category');
    // Post image
    beans_modify_action('beans_post_image', 'beans_post_header_before_markup', 'beans_post_image');
    // Post title
    beans_add_attribute('beans_post_title', 'class', 'uk-margin-small-top uk-h3');
    // Post more link
    //beans_add_attribute( 'beans_post_more_link', 'class', 'uk-button uk-button-small' );
    // Posts pagination
    beans_modify_action_hook('beans_posts_pagination', 'beans_content_after_markup');
}
Example #2
0
function banks_setup_document()
{
    // Frontpage posts
    if (is_home()) {
        beans_remove_attribute('beans_post', 'class', 'uk-panel-box');
    }
    // Site Logo
    beans_remove_attribute('beans_site_title_tag', 'class', 'uk-text-muted');
    // Breadcrumb
    beans_remove_action('beans_breadcrumb');
    // Post meta
    beans_add_attribute('beans_post_meta_date', 'class', 'uk-text-muted');
    // Search form
    beans_replace_attribute('beans_search_form', 'class', 'uk-form-icon uk-form-icon-flip', 'uk-display-inline-block');
    beans_remove_markup('beans_search_form_input_icon');
    // Add grid min width for Banks slim content
    if (beans_get_layout() == 'banks_c') {
        beans_add_attribute('beans_content', 'class', 'tm-centered-content');
    }
    // Only applies to singular and not pages
    if (is_singular() && !is_page()) {
        // Post title
        beans_add_attribute('beans_post_title', 'class', 'uk-margin-small-bottom');
        // Post navigation
        beans_add_attribute('beans_post_navigation', 'class', 'uk-grid-margin uk-margin-bottom-remove');
        // Post comments
        beans_add_attribute('beans_comments', 'class', 'uk-margin-bottom-remove');
        beans_add_attribute('beans_comment_form_wrap', 'class', 'uk-contrast');
        beans_add_attribute('beans_comment_form_submit', 'class', 'uk-button-large');
        beans_add_attribute('beans_no_comment', 'class', 'tm-no-comments uk-text-center uk-text-large uk-block');
    }
    if (get_bloginfo('description')) {
        beans_add_attribute('beans_primary_menu', 'class', 'uk-margin-small-top');
    }
}
function flipster_setup_document()
{
    // Header and Primary Menu
    beans_remove_attribute('beans_site_branding', 'class', 'uk-float-left');
    beans_remove_attribute('beans_primary_menu', 'class', 'uk-float-right');
    // Layout
    if (beans_get_layout() != 'c') {
        beans_remove_attribute('beans_primary', 'class', 'uk-width-medium-7-10');
        beans_add_attribute('beans_primary', 'class', 'uk-width-large-7-10');
        beans_remove_attribute('beans_sidebar_primary', 'class', 'uk-width-medium-3-10');
        beans_add_attribute('beans_sidebar_primary', 'class', 'uk-width-large-3-10 uk-visible-large');
    }
    // Breadcrumb
    if (!is_archive()) {
        beans_remove_action('beans_breadcrumb');
    }
    // Navigation
    beans_add_attribute('beans_sub_menu_wrap', 'class', 'uk-dropdown-center');
    beans_remove_attribute('beans_menu_item_child_indicator', 'class', 'uk-margin-small-left');
    // Post content
    beans_add_attribute('beans_post_content', 'class', 'uk-text-large');
    // Post meta
    beans_remove_action('beans_post_meta_categories');
    beans_remove_output('beans_post_meta_categories_prefix');
    beans_remove_output('beans_post_meta_date_prefix');
    beans_add_attribute('beans_post_meta_date', 'class', 'uk-text-muted');
    // Post embed
    beans_add_attribute('beans_embed_oembed', 'class', 'tm-cover-article');
    // Comment form
    beans_add_attribute('beans_comment_form_wrap', 'class', 'tm-cover-article');
    beans_add_attribute('beans_comment_fields_inner_wrap', 'class', 'uk-grid-small');
    beans_add_attribute('beans_comment_form_submit', 'class', 'uk-button-large');
    if (!is_user_logged_in()) {
        beans_replace_attribute('beans_comment_form_comment', 'class', 'uk-width-medium-1-1', 'uk-width-medium-6-10');
    } else {
        //Add edit post link when user is logged in
        if (is_singular()) {
            beans_add_smart_action('beans_post_header_before_markup', 'flipster_edit_link');
        }
    }
    // Only applies to singular and not pages
    if (is_singular() && !is_page()) {
        //remove featured image
        beans_remove_action('beans_post_image');
        // Post title
        beans_add_attribute('beans_post_title', 'class', 'uk-margin-bottom');
        //Widget area after post content
        beans_add_smart_action('the_content', 'flipster_widget_after_post_content');
        // Post author profile
        add_action('beans_comments_before_markup', 'flipster_author_profile');
    }
    // Search
    if (is_search()) {
        beans_remove_action('beans_post_image');
    }
}
/**
 * Get the current layout.
 *
 * This function generate the layout class base on the current layout.
 *
 * @since 1.0.0
 *
 * @param string $id The searched layout section ID.
 *
 * @return bool Layout class, false if no layout class found.
 */
function beans_get_layout_class($id)
{
    /**
     * Filter the arguments used to define the layout grid.
     *
     * The content number of columns are automatically calculated based on the grid, sidebar primary and
     * sidebar secondary columns.
     *
     * @since 1.0.0
     *
     * @param array $args {
     *     An array of arguments.
     *
     *     @type int $grid              Total number of columns the grid contains. Default 4.
     *     @type int $sidebar_primary   The number of columns the sidebar primary takes. Default 1.
     *     @type int $sidebar_secondary The number of columns the sidebar secondary takes. Default 1.
     * }
     */
    $args = apply_filters('beans_layout_grid_settings', array('grid' => 4, 'sidebar_primary' => 1, 'sidebar_secondary' => 1));
    $g = beans_get('grid', $args);
    // $g stands for grid.
    $c = $g;
    // $c stands for content. Same value as grid by default
    $sp = beans_get('sidebar_primary', $args);
    // $sp stands for sidebar primary.
    $ss = beans_get('sidebar_secondary', $args);
    // $ss stands for 'sidebar secondary.
    $prefix = 'uk-width-medium';
    $classes = array();
    switch ($layout = beans_get_layout()) {
        case 'c':
            $classes['content'] = "{$prefix}-{$c}-{$g}";
            break;
        default:
            $classes['content'] = "{$prefix}-{$c}-{$g}";
    }
    // Add sidebar primary layouts if the primary widget area is registered.
    if ($has_primary = beans_has_widget_area('sidebar_primary')) {
        switch ($layout) {
            case 'c_sp':
                $c = $g - $sp;
                $classes['content'] = "{$prefix}-{$c}-{$g}";
                $classes['sidebar_primary'] = "{$prefix}-{$sp}-{$g}";
                break;
            case 'sp_c':
                $c = $g - $sp;
                $classes['content'] = "{$prefix}-{$c}-{$g} uk-push-{$sp}-{$g}";
                $classes['sidebar_primary'] = "{$prefix}-{$sp}-{$g} uk-pull-{$c}-{$g}";
                break;
        }
    }
    // Add sidebar secondary layouts if the primary and secondary widget area are registered.
    if ($has_primary && beans_has_widget_area('sidebar_secondary')) {
        switch ($layout) {
            case 'c_ss':
                $c = $g - $sp;
                $classes['content'] = "{$prefix}-{$c}-{$g}";
                $classes['sidebar_secondary'] = "{$prefix}-{$sp}-{$g}";
                break;
            case 'c_sp_ss':
                $c = $g - ($sp + $ss);
                $classes['content'] = "{$prefix}-{$c}-{$g}";
                $classes['sidebar_primary'] = "{$prefix}-{$sp}-{$g}";
                $classes['sidebar_secondary'] = "{$prefix}-{$ss}-{$g}";
                break;
            case 'ss_c':
                $c = $g - $sp;
                $classes['content'] = "{$prefix}-{$c}-{$g} uk-push-{$sp}-{$g}";
                $classes['sidebar_secondary'] = "{$prefix}-{$sp}-{$g} uk-pull-{$c}-{$g}";
                break;
            case 'sp_ss_c':
                $c = $g - ($sp + $ss);
                $push_content = $sp + $ss;
                $classes['content'] = "{$prefix}-{$c}-{$g} uk-push-{$push_content}-{$g}";
                $classes['sidebar_primary'] = "{$prefix}-{$sp}-{$g} uk-pull-{$c}-{$g}";
                $classes['sidebar_secondary'] = "{$prefix}-{$ss}-{$g} uk-pull-{$c}-{$g}";
                break;
            case 'sp_c_ss':
                $c = $g - ($sp + $ss);
                $classes['content'] = "{$prefix}-{$c}-{$g} uk-push-{$sp}-{$g}";
                $classes['sidebar_primary'] = "{$prefix}-{$sp}-{$g} uk-pull-{$c}-{$g}";
                $classes['sidebar_secondary'] = "{$prefix}-{$ss}-{$g}";
                break;
        }
    }
    /**
     * Filter the layout class.
     *
     * The dynamic portion of the hook name refers to the searched layout section ID.
     *
     * @since 1.0.0
     *
     * @param string $layout The layout class.
     */
    return apply_filters("beans_layout_class_{$id}", beans_get($id, $classes));
}
function bench_setup_document()
{
    // Add a top element for scroll
    beans_add_smart_action('beans_site_before_markup', 'bench_top_element');
    // Frontpage posts
    if (is_home()) {
        beans_add_smart_action('beans_header_after_markup', 'bench_site_title_tag');
    }
    // Site Logo
    beans_remove_action('beans_site_title_tag');
    // Layout
    if (beans_get_layout() != 'c' && beans_get_layout() != 'bench_c') {
        beans_remove_attribute('beans_primary', 'class', 'uk-width-medium-7-10');
        beans_add_attribute('beans_primary', 'class', 'uk-width-large-7-10');
        beans_remove_attribute('beans_sidebar_primary', 'class', 'uk-width-medium-3-10');
        beans_add_attribute('beans_sidebar_primary', 'class', 'uk-width-large-3-10 uk-visible-large');
    }
    // Post meta
    beans_add_attribute('beans_post_meta_date', 'class', 'uk-text-muted');
    // Search form
    beans_replace_attribute('beans_search_form', 'class', 'uk-form-icon uk-form-icon-flip', 'uk-display-inline-block');
    beans_remove_markup('beans_search_form_input_icon');
    // Add grid min width for Bench slim content
    if (beans_get_layout() == 'bench_c') {
        beans_add_attribute('beans_content', 'class', 'tm-centered-content');
    }
    if (is_user_logged_in()) {
        //Add edit post link when user is logged in
        if (is_singular()) {
            beans_add_smart_action('beans_post_header_before_markup', 'bench_edit_link');
        }
    }
    // Only applies to singular and not pages
    if (is_singular() && !is_page()) {
        //remove breadcrumb
        beans_remove_action('beans_breadcrumb');
        //remove featured image
        beans_remove_action('beans_post_image');
        // Post navigation
        beans_add_attribute('beans_post_navigation', 'class', 'uk-grid-margin');
        // Post author profile
        add_action('beans_comments_before_markup', 'bench_author_profile');
        // Post comments
        beans_add_attribute('beans_comments', 'class', 'uk-margin-bottom-remove');
        beans_add_attribute('beans_comment_form_wrap', 'class', 'uk-contrast');
        beans_add_attribute('beans_no_comment', 'class', 'tm-no-comments uk-text-center uk-text-large uk-block');
        beans_remove_action('beans_comment_form_divider');
    }
}
Example #6
0
/**
 * Echo secondary sidebar template part.
 *
 * The secondary sidebar template part only loads if the layout set includes it, thus prevent unnecessary memory usage.
 *
 * @since 1.0.0
 */
function beans_sidebar_secondary_template()
{
    if (stripos(beans_get_layout(), 'ss') === false || !beans_has_widget_area('sidebar_secondary')) {
        return;
    }
    get_sidebar('secondary');
}