コード例 #1
1
ファイル: page_home.php プロジェクト: kkthemes/kkthemes
function kkthemes_homepage_setup_document()
{
    beans_add_smart_action('beans_header_after_markup', 'kkthemes_site_title_tag');
    beans_add_smart_action('beans_content_after_markup', 'kkthemes_homepage_contents');
    kkthemes_post_view(true);
    //change this to manually output post loop when more post types are there.
    beans_add_filter('beans_loop_query_args[_main]', 'kkthemes_theme_home_query_args');
    //remove pagination
    beans_remove_action('beans_posts_pagination');
}
コード例 #2
0
ファイル: post-views.php プロジェクト: kkthemes/kkthemes
function kkthemes_post_view($featured_items = false)
{
    // Posts grid
    beans_add_attribute('beans_post', 'class', 'tm-post-grid uk-grid uk-grid-medium');
    beans_add_attribute('beans_post_image', 'class', 'uk-width-medium-1-2');
    beans_wrap_markup('beans_post_header', 'kkthemes_post_preview', 'div', array('class' => 'tm-post-preview uk-width-medium-1-2'));
    if (is_featured_item() || $featured_items) {
        //More button
        beans_add_attribute('beans_post_more_link', 'class', 'uk-button uk-button-large uk-margin-top');
    } else {
        // Post title
        beans_add_attribute('beans_post_title', 'class', 'uk-h2');
    }
    // Post content
    beans_remove_action('beans_post_content');
    beans_remove_markup('beans_post_body');
    add_action('kkthemes_post_preview_append_markup', 'the_content');
    // Auto generate summary of Post content and read more button
    beans_add_smart_action('the_content', 'kkthemes_post_content');
    // Post meta
    beans_remove_action('beans_post_meta_tags');
    beans_remove_action('beans_post_meta_categories');
    // Post image
    beans_modify_action('beans_post_image', 'beans_post_header_before_markup', 'beans_post_image');
}
コード例 #3
0
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');
    }
}
コード例 #4
0
ファイル: index.php プロジェクト: kkthemes/kkthemes
function kkthemes_index_setup_document()
{
    if (is_main_archive()) {
        // Remove breadcrumb if this is main archive (accessible from main menu)
        // Other archives like Tags archive, author archive, month archive etc will continue to have breadcumb
        beans_remove_action('beans_breadcrumb');
        //Add a large Title panel in these archive pages
        beans_add_smart_action('beans_header_after_markup', 'kkthemes_archive_title');
    }
    kkthemes_post_view();
    // Posts pagination
    beans_modify_action_hook('beans_posts_pagination', 'beans_content_after_markup');
}
コード例 #5
0
ファイル: page.php プロジェクト: kkthemes/kkthemes
function kkthemes_page_setup_document()
{
    //Remove breadcrumb
    beans_remove_action('beans_breadcrumb');
    //Remove padding from main wrapper
    beans_remove_attribute('beans_main', 'class', 'uk-block');
    beans_remove_attribute('beans_post', 'class', 'uk-article');
    //Remove container so we can have full width Page title
    beans_remove_attribute('beans_fixed_wrap[_main]', 'class', 'uk-container');
    beans_remove_attribute('beans_fixed_wrap[_main]', 'class', '-center');
    $tag_style = '';
    $header_image = get_header_image();
    if (!empty($header_image)) {
        $tag_style = 'background-image: url(' . esc_url($header_image) . ');';
    }
    //Add styling to Page header
    beans_wrap_inner_markup('beans_post_header', 'kk_themes_page_header', 'div', array('class' => 'uk-panel uk-panel-box uk-panel-space uk-text-large uk-text-center uk-margin-large-bottom tm-branded-panel', 'style' => $tag_style));
    // Display any Post excerpts below Page title.
    beans_add_smart_action('beans_post_header_append_markup', the_excerpt);
    //Center page content and add a large bottom margin since we removed uk-block earlier from beans_main
    beans_add_attribute('beans_post_body', 'class', 'uk-container uk-container-center tm-maxwidth-content uk-margin-large-bottom');
}
コード例 #6
0
ファイル: functions.php プロジェクト: kkthemes/kkthemes
function kkthemes_setup_document()
{
    beans_remove_action('beans_header_image');
    //remove default header image
    // Move breadcrumb just below header
    beans_modify_action_hook('beans_breadcrumb', 'beans_header_after_markup');
    beans_add_attribute('beans_breadcrumb', 'class', 'uk-container uk-container-center uk-hidden-small');
    // Site Logo
    beans_remove_action('beans_site_title_tag');
    //Add back site title after logo image
    //beans_add_smart_action('beans_logo_image_after_markup', 'kkthemes_site_title');
    if (is_user_logged_in()) {
        //Add edit post link when user is logged in
        if (is_singular() && !is_page_template('page_home.php')) {
            beans_add_smart_action('beans_post_header_prepend_markup', 'kkthemes_edit_link');
        }
    }
    //content
    beans_remove_attribute('beans_post', 'class', 'uk-panel-box');
    //comments
    beans_remove_attribute('beans_comments', 'class', 'uk-panel-box');
}
コード例 #7
0
    beans_modify_markup('beans_post_title', 'h2');
    beans_add_attribute('beans_post_title', 'class', 'uk-h2');
    beans_add_attribute('beans_post', 'class', 'uk-grid-margin');
    // Post image
    beans_remove_action('beans_post_image');
    // Post meta
    beans_remove_action('beans_post_meta');
    beans_remove_action('beans_post_meta_tags');
    beans_remove_action('beans_post_meta_categories');
    // Remove article search
    beans_remove_output('beans_no_post_search_form');
}
// Add the search form
beans_add_smart_action('beans_search_title_after_markup', 'fast_monkey_search_field');
function fast_monkey_search_field($content)
{
    echo beans_open_markup('fast_monkey_search_content', 'div', array('class' => 'uk-grid-margin'));
    get_search_form();
    echo beans_close_markup('fast_monkey_search_content', 'div');
}
// Clean up the search results item markup
beans_add_smart_action('the_content', 'fast_monkey_search_content');
function fast_monkey_search_content($content)
{
    $output = beans_open_markup('fast_monkey_search_content', 'p');
    $output .= beans_output('fast_monkey_search_post_content', substr(strip_tags($content), 0, 150) . ' ...');
    $output .= beans_close_markup('fast_monkey_search_content', 'p');
    return $output;
}
// Load beans document.
beans_load_document();
コード例 #8
0
ファイル: assets.php プロジェクト: KevinFairbanks/Beans
 * Beans style is enqueued with the UIKit components to have access to UIKit LESS variables.
 *
 * @since 1.0.0
 */
function beans_enqueue_uikit_components()
{
    $core = array('base', 'block', 'grid', 'article', 'comment', 'panel', 'nav', 'navbar', 'subnav', 'table', 'breadcrumb', 'pagination', 'list', 'form', 'button', 'badge', 'alert', 'dropdown', 'offcanvas', 'text', 'utility', 'icon');
    beans_uikit_enqueue_components($core);
    // Include uikit default theme.
    beans_uikit_enqueue_theme('default');
    // Enqueue uikit overwrite theme folder.
    beans_uikit_enqueue_theme('beans', BEANS_ASSETS_URL . 'less/uikit-overwrite');
    // Add the theme style as a uikit fragment to have access to all the variables.
    beans_compiler_add_fragment('uikit', BEANS_ASSETS_URL . 'less/style.less', 'less');
    // Add the theme default style as a uikit fragment only if the theme supports it.
    if (current_theme_supports('beans-default-styling')) {
        beans_compiler_add_fragment('uikit', BEANS_ASSETS_URL . 'less/default.less', 'less');
    }
}
beans_add_smart_action('wp_enqueue_scripts', 'beans_enqueue_assets', 5);
/**
 * Enqueue Beans assets.
 *
 * @since 1.0.0
 */
function beans_enqueue_assets()
{
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
コード例 #9
0
ファイル: functions.php プロジェクト: ThemeButler/tm-site
	// Replace content with excerpt and more link if not singular.
    elseif ( is_home() )
		return '<p>' . get_the_excerpt() . '</p><p class="uk-margin-bottom-remove">'.  beans_post_more_link() .  '</p>';

}


// Register the help menu
register_nav_menus( array(
	'help' => 'Help Menu'
) );


// Register bottom widget area
beans_add_smart_action( 'widgets_init', 'banks_register_bottom_widget_area' );

function banks_register_bottom_widget_area() {

	beans_register_widget_area( array(
		'name' => 'Footer',
		'id' => 'footer',
		'description' => 'Widgets in this area will be shown in the footer section as a grid.',
		'beans_type' => 'grid'
	) );

}


// Add footer content
beans_modify_action_callback( 'beans_footer_content', 'tbr_footer' );
コード例 #10
0
ファイル: single.php プロジェクト: kkthemes/kkthemes
<?php

/* Helpers and utility functions */
require_once 'include/helpers.php';
beans_add_smart_action('beans_before_load_document', 'kkthemes_single_setup_document');
function kkthemes_single_setup_document()
{
    beans_remove_action('beans_breadcrumb');
    //remove featured image
    beans_remove_action('beans_post_image');
    //Center page content and add a large bottom margin since we removed uk-block earlier from beans_main
    beans_add_attribute('beans_main', 'class', 'tm-maxwidth-content');
}
// Load beans document
beans_load_document();
コード例 #11
0
ファイル: functions.php プロジェクト: ThemeButler/tbr-jenkins
    echo beans_close_markup('jenkins_post_meta_item_comments_icon', 'i');
}
// Remove comment after note (filter)
beans_add_smart_action('comment_form_defaults', 'jenkins_comment_form_defaults');
function jenkins_comment_form_defaults($args)
{
    $args['comment_notes_after'] = '';
    return $args;
}
// Add avatar uikit circle class (filter)
beans_add_smart_action('get_avatar', 'jenkins_avatar');
function jenkins_avatar($output)
{
    return str_replace("class='avatar", "class='avatar uk-border-circle", $output);
}
// Modify the tags cloud widget
beans_add_smart_action('wp_generate_tag_cloud', 'jenkins_widget_tags_cloud');
function jenkins_widget_tags_cloud($output)
{
    return preg_replace("#style='font-size:.+pt;'#", '', $output);
}
// Add footer content (filter)
beans_add_smart_action('beans_footer_credit_right_text_output', 'jenkins_footer');
function jenkins_footer()
{
    ?>

  <a href="http://www.themebutler.com/themes/jenkins/" target="_blank" title="Jenkins theme for WordPress">Jenkins</a> theme for <a href="http://wordpress.org" target="_blank">WordPress</a>. Built-with <a href="http://www.getbeans.io/" title="Beans Framework for WordPress" target="_blank">Beans</a>.

<?php 
}
コード例 #12
0
ファイル: slider.php プロジェクト: KevinFairbanks/Beans
<?php

/**
 * @package API\Fields\Types
 */
beans_add_smart_action('beans_field_enqueue_scripts_slider', 'beans_field_slider_assets');
/**
 * Enqueued assets required by the beans slider field.
 *
 * @since 1.0.0
 */
function beans_field_slider_assets()
{
    wp_enqueue_script('jquery-ui-slider');
}
beans_add_smart_action('beans_field_slider', 'beans_field_slider');
/**
 * Echo slider field type.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      For best practices, pass the array of data obtained using {@see beans_get_fields()}.
 *
 *      @type mixed  $value      The field value.
 *      @type string $name       The field name value.
 *      @type array  $attributes An array of attributes to add to the field. The array key defines the
 *            					 attribute name and the array value defines the attribute value. Default array.
 *      @type mixed  $default    The default value. Default false.
 *      @type string $min        The slider minimum value. Default 0.
 *      @type string $max        The slider maximum value. Default 100.
コード例 #13
0
ファイル: widget.php プロジェクト: KevinFairbanks/Beans
    echo beans_output('beans_widget_title_text', $title);
    echo beans_close_markup('beans_widget_title' . _beans_widget_subfilters(), 'h3');
}
beans_add_smart_action('beans_widget', 'beans_widget_content', 15);
/**
 * Echo widget content.
 *
 * @since 1.0.0
 */
function beans_widget_content()
{
    echo beans_open_markup('beans_widget_content' . _beans_widget_subfilters(), 'div');
    echo beans_output('beans_widget_content' . _beans_widget_subfilters(), beans_get_widget('content'));
    echo beans_close_markup('beans_widget_content' . _beans_widget_subfilters(), 'div');
}
beans_add_smart_action('beans_no_widget', 'beans_no_widget');
/**
 * Echo no widget content.
 *
 * @since 1.0.0
 */
function beans_no_widget()
{
    // Only apply this notice to sidebar_primary and sidebar_secondary.
    if (!in_array(beans_get_widget_area('id'), array('sidebar_primary', 'sidebar_secondary'))) {
        return;
    }
    echo beans_open_markup('beans_no_widget_notice', 'p', array('class' => 'uk-alert uk-alert-warning'));
    echo beans_output('beans_no_widget_notice_text', sprintf(__('%s does not have any widget assigned!', 'tm-beans'), beans_get_widget_area('name')));
    echo beans_close_markup('beans_no_widget_notice', 'p');
}
コード例 #14
0
ファイル: select.php プロジェクト: ThemeButler/tm-demo
<?php

/**
 * @package Beans\API\Fields\Types
 */
beans_add_smart_action('beans_field_select', 'beans_field_select');
/**
 * Echo select field type.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      For best practices, pass the array of data obtained using {@see beans_get_fields()}.
 *
 *      @type mixed  $value      The field value.
 *      @type string $name       The field name value.
 *      @type array  $attributes An array of attributes to add to the field. The array key defines the
 *            					 attribute name and the array value defines the attribute value. Default array.
 *      @type mixed  $default    The default value. Default false.
 *      @type array  $options    An array used to populate the select options. The array key defines option
 *            					 value and the array value defines the option label.
 * }
 */
function beans_field_select($field)
{
    if (empty($field['options'])) {
        return;
    }
    echo '<select name="' . $field['name'] . '" ' . beans_sanatize_attributes($field['attributes']) . '>';
    foreach ($field['options'] as $value => $label) {
        $selected = $value == $field['value'] ? ' selected="selected"' : null;
コード例 #15
0
ファイル: footer.php プロジェクト: ThemeButler/tm-demo
 * @since 1.0.0
 */
function beans_footer_content()
{
    echo beans_open_markup('beans_footer_credit', 'div', array('class' => 'uk-clearfix uk-text-small uk-text-muted'));
    echo beans_open_markup('beans_footer_credit_left', 'span', array('class' => 'uk-align-medium-left uk-margin-small-bottom'));
    echo beans_output('beans_footer_credit_text', sprintf(__('&#x000A9; %1$s - %2$s. All rights reserved.', 'beans'), date("Y"), get_bloginfo('name')));
    echo beans_close_markup('beans_footer_credit_left', 'span');
    $framework_link = beans_open_markup('beans_footer_credit_framework_link', 'a', array('href' => esc_url('https://themebeans.com/beans'), 'rel' => 'designer'));
    $framework_link .= beans_output('beans_footer_credit_framework_link_text', 'Beans');
    $framework_link .= beans_close_markup('beans_footer_credit_framework_link', 'a');
    echo beans_open_markup('beans_footer_credit_right', 'span', array('class' => 'uk-align-medium-right uk-margin-bottom-remove'));
    echo beans_output('beans_footer_credit_right_text', sprintf(__('%1$s theme for WordPress.', 'beans'), $framework_link));
    echo beans_close_markup('beans_footer_credit_right', 'span');
    echo beans_close_markup('beans_footer_credit', 'div');
}
beans_add_smart_action('wp_footer', 'beans_replace_nojs_class');
/**
 * Print inline JavaScript in the footer to replace the 'no-js' class with 'js'.
 *
 * @since 1.0.0
 */
function beans_replace_nojs_class()
{
    ?>
<script type="text/javascript">
		(function() {
			document.body.className = document.body.className.replace('no-js','js');
		}());
	</script><?php 
}
コード例 #16
0
ファイル: post.php プロジェクト: ThemeButler/tm-demo
    echo beans_open_markup('beans_post_title', 'h1', array('class' => 'uk-article-title'));
    echo beans_output('beans_no_post_article_title_text', __('Whoops, no result found!', 'beans'));
    echo beans_close_markup('beans_post_title', 'h1');
    echo beans_close_markup('beans_post_header', 'header');
    echo beans_open_markup('beans_post_body', 'div');
    echo beans_open_markup('beans_post_content', 'div', array('class' => 'tm-article-content'));
    echo beans_open_markup('beans_no_post_article_content', 'p', array('class' => 'uk-alert uk-alert-warning'));
    echo beans_output('beans_no_post_article_content_text', __('It looks like nothing was found at this location. Maybe try a search?', 'beans'));
    echo beans_close_markup('beans_no_post_article_content', 'p');
    echo beans_output('beans_no_post_search_form', get_search_form(false));
    echo beans_close_markup('beans_post_content', 'div');
    echo beans_close_markup('beans_post_body', 'div');
    echo beans_close_markup('beans_post', 'article');
}
// Filter.
beans_add_smart_action('the_password_form', 'beans_post_password_form');
/**
 * Modify password protected form.
 *
 * @since 1.0.0
 *
 * @return string The form.
 */
function beans_post_password_form()
{
    global $post;
    $label = 'pwbox-' . (empty($post->ID) ? rand() : $post->ID);
    // Notice.
    $output = beans_open_markup('beans_password_form_notice', 'p', array('class' => 'uk-alert uk-alert-warning'));
    $output .= beans_output('beans_password_form_notice_text', __('This post is protected. To view it, enter the password below!', 'beans'));
    $output .= beans_close_markup('beans_password_form_notice', 'p');
コード例 #17
0
ファイル: menu.php プロジェクト: JoomPassion/Beans
 * Echo primary menu offcanvas button.
 *
 * @since 1.0.0
 */
function beans_primary_menu_offcanvas_button()
{
    if (!current_theme_supports('offcanvas-menu')) {
        return;
    }
    echo beans_open_markup('beans_primary_menu_offcanvas_button', 'a', array('href' => '#offcanvas_menu', 'class' => 'uk-button uk-hidden-large', 'data-uk-offcanvas' => ''));
    echo beans_open_markup('beans_primary_menu_offcanvas_button_icon', 'i', array('class' => 'uk-icon-navicon uk-margin-small-right'));
    echo beans_close_markup('beans_primary_menu_offcanvas_button_icon', 'i');
    echo beans_output('beans_offcanvas_menu_button', __('Menu', 'beans'));
    echo beans_close_markup('beans_primary_menu_offcanvas_button', 'a');
}
beans_add_smart_action('beans_widget_area_offcanvas_bar_offcanvas_menu_prepend_markup', 'beans_primary_offcanvas_menu');
/**
 * Echo off-canvas primary menu.
 *
 * @since 1.0.0
 */
function beans_primary_offcanvas_menu()
{
    if (!current_theme_supports('offcanvas-menu')) {
        return;
    }
    echo beans_open_markup('beans_primary_offcanvas_menu', 'nav', array('class' => 'tm-primary-offcanvas-menu uk-margin uk-margin-top', 'role' => 'navigation'));
    $args = apply_filters('beans_primary_offcanvas_menu_args', array('theme_location' => has_nav_menu('primary') ? 'primary' : '', 'fallback_cb' => 'beans_no_menu_notice', 'container' => '', 'echo' => false, 'beans_type' => 'offcanvas'));
    echo beans_output('beans_primary_offcanvas_menu', wp_nav_menu($args));
    echo beans_close_markup('beans_primary_offcanvas_menu', 'nav');
}
コード例 #18
0
ファイル: options.php プロジェクト: KevinFairbanks/Beans
 * Add Beans term meta.
 *
 * @since 1.0.0
 */
function beans_do_register_term_meta()
{
    // Get layout option without default for the count.
    $options = beans_get_layouts_for_options();
    // Stop here if there is less than two layouts options.
    if (count($options) < 2) {
        return;
    }
    $fields = array(array('id' => 'beans_layout', 'label' => _x('Layout', 'term meta', 'tm-beans'), 'type' => 'radio', 'default' => 'default_fallback', 'options' => beans_get_layouts_for_options(true)));
    beans_register_term_meta($fields, array('category', 'post_tag'), 'tm-beans');
}
beans_add_smart_action('admin_init', 'beans_do_register_post_meta');
/**
 * Add Beans post meta.
 *
 * @since 1.0.0
 */
function beans_do_register_post_meta()
{
    // Get layout option without default for the count.
    $options = beans_get_layouts_for_options();
    // Stop here if there is less than two layouts options.
    if (count($options) < 2) {
        return;
    }
    $fields = array(array('id' => 'beans_layout', 'label' => _x('Layout', 'post meta', 'tm-beans'), 'type' => 'radio', 'default' => 'default_fallback', 'options' => beans_get_layouts_for_options(true)));
    beans_register_post_meta($fields, array('post', 'page'), 'tm-beans', array('title' => __('Post Options', 'tm-beans')));
コード例 #19
0
ファイル: text.php プロジェクト: Getbeans/Beans
<?php

/**
 * @package API\Fields\Types
 */
beans_add_smart_action('beans_field_text', 'beans_field_text');
/**
 * Echo text field type.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      For best practices, pass the array of data obtained using {@see beans_get_fields()}.
 *
 *      @type mixed  $value      The field value.
 *      @type string $name       The field name value.
 *      @type array  $attributes An array of attributes to add to the field. The array key defines the
 *            					 attribute name and the array value defines the attribute value. Default array.
 *      @type mixed  $default    The default value. Default false.
 * }
 */
function beans_field_text($field)
{
    ?>
	<input type="text" name="<?php 
    echo esc_attr($field['name']);
    ?>
" value="<?php 
    echo esc_attr($field['value']);
    ?>
" <?php 
コード例 #20
0
ファイル: image.php プロジェクト: ThemeButler/tm-demo
/**
 * @package Beans\API\Fields\Types
 */
beans_add_smart_action('beans_field_enqueue_scripts_image', 'beans_field_image_assets');
/**
 * Enqueued assets required by the beans image field.
 *
 * @since 1.0.0
 */
function beans_field_image_assets()
{
    wp_enqueue_media();
    wp_enqueue_script('jquery-ui-sortable');
    wp_enqueue_script('beans-field-media', BEANS_API_COMPONENTS_URL . 'fields/assets/js/media' . BEANS_MIN_CSS . '.js', array('jquery'), BEANS_VERSION);
}
beans_add_smart_action('beans_field_image', 'beans_field_image');
/**
 * Echo image field type.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      For best practices, pass the array of data obtained using {@see beans_get_fields()}.
 *
 *      @type mixed  $value      The field value.
 *      @type string $name       The field name value.
 *      @type array  $attributes An array of attributes to add to the field. The array key defines the
 *            					 attribute name and the array value defines the attribute value. Default array.
 *      @type mixed  $default    The default value. Default false.
 *      @type string $multiple   Set to true to enable mutliple images (gallery). Default false.
 * }
コード例 #21
0
ファイル: comments.php プロジェクト: MatRouault/Beans
    // Url.
    $url = beans_open_markup('beans_comment_form[_website]', 'div', array('class' => 'uk-width-medium-1-3'));
    /**
     * Filter whether the comment form url legend should load or not.
     *
     * @since 1.0.0
     */
    if (beans_apply_filters('beans_comment_form_legend[_url]', true)) {
        $url .= beans_open_markup('beans_comment_form_legend', 'legend');
        $url .= beans_output('beans_comment_form_legend_text[_url]', __('Website', 'tm-beans'));
        $url .= beans_close_markup('beans_comment_form_legend[_url]', 'legend');
    }
    $url .= beans_selfclose_markup('beans_comment_form_field[_url]', 'input', array('id' => 'url', 'class' => 'uk-width-1-1', 'type' => 'text', 'value' => esc_attr($commenter['comment_author_url']), 'name' => 'url'));
    $url .= beans_close_markup('beans_comment_form[_website]', 'div');
    $fields = array('author' => $author, 'email' => $email, 'url' => $url);
    return $fields;
}
beans_add_smart_action('comment_form_after_fields', 'beans_comment_form_after_fields', 3);
/**
 * Echo comment fields closing wraps.
 *
 * This function must be attached to the WordPress 'comment_form_after_fields' action which is only called if
 * the user is not logged in.
 *
 * @since 1.0.0
 */
function beans_comment_form_after_fields()
{
    echo beans_close_markup('beans_comment_fields_inner_wrap', 'div');
    echo beans_close_markup('beans_comment_fields_wrap', 'div');
}
コード例 #22
0
ファイル: embed.php プロジェクト: KevinFairbanks/Beans
<?php

/**
 * Extends WordPress Embed.
 *
 * @package Render\Embed
 */
// Filter.
beans_add_smart_action('embed_oembed_html', 'beans_embed_oembed');
/**
 * Add markup to embed.
 *
 * @since 1.0.0
 *
 * @param string $html The embed HTML.
 *
 * @return string The modified embed HTML.
 */
function beans_embed_oembed($html)
{
    $output = beans_open_markup('beans_embed_oembed', 'div', 'class=tm-oembed');
    $output .= $html;
    $output .= beans_close_markup('beans_embed_oembed', 'div');
    return $output;
}
コード例 #23
0
ファイル: header.php プロジェクト: ThemeButler/tm-demo
 *
 * @since 1.0.0
 */
function beans_site_branding()
{
    $name = beans_output('beans_site_title_text', get_bloginfo('name'));
    if ($logo = get_theme_mod('beans_logo_image', false)) {
        $name = beans_selfclose_markup('beans_logo_image', 'img', array('class' => 'tm-logo', 'src' => $logo, 'alt' => $name));
    }
    echo beans_open_markup('beans_site_branding', 'div', array('class' => 'tm-site-branding uk-float-left' . (!get_bloginfo('description') ? ' uk-margin-small-top' : null)));
    echo beans_open_markup('beans_site_title_link', 'a', array('href' => esc_url(home_url('/')), 'rel' => 'home'));
    echo $name;
    echo beans_close_markup('beans_site_title_link', 'a');
    echo beans_close_markup('beans_site_branding', 'div');
}
beans_add_smart_action('beans_site_branding_append_markup', 'beans_site_title_tag');
/**
 * Echo header site title tag.
 *
 * @since 1.0.0
 */
function beans_site_title_tag()
{
    // Stop here if there isn't a description.
    if (!($description = get_bloginfo('description'))) {
        return;
    }
    echo beans_open_markup('beans_site_title_tag', 'span', array('class' => 'tm-site-title-tag uk-text-small uk-text-muted uk-display-block'));
    echo beans_output('beans_site_title_tag_text', $description);
    echo beans_close_markup('beans_site_title_tag', 'span');
}
コード例 #24
0
<?php

// Modify the 404 page markup
beans_add_smart_action('beans_before_load_document', 'bench_404_setup_document');
function bench_404_setup_document()
{
    // Post
    beans_remove_attribute('beans_no_post_article_content', 'class', 'uk-alert uk-alert-warning');
    beans_modify_markup('beans_no_post_article_content', 'h2');
    beans_add_attribute('beans_no_post_article_content', 'class', 'uk-margin-large-bottom');
}
// Update the 404 page title
beans_add_smart_action('beans_no_post_article_title_text_output', 'bench_404_post_title');
function bench_404_post_title()
{
    return beans_output('bench_no_post_article_title_text', __('404', 'bench'));
}
// Update the 404 page content
beans_add_smart_action('beans_no_post_article_content_text_output', 'bench_404_post_content');
function bench_404_post_content()
{
    return beans_output('bench_no_post_article_content_text', __('Page not found', 'bench'));
}
// Load Beans document
beans_load_document();
コード例 #25
0
ファイル: post.php プロジェクト: Getbeans/Beans
{
    global $post;
    $label = 'pwbox-' . (empty($post->ID) ? rand() : $post->ID);
    // Notice.
    $output = beans_open_markup('beans_password_form_notice', 'p', array('class' => 'uk-alert uk-alert-warning'));
    $output .= beans_output('beans_password_form_notice_text', __('This post is protected. To view it, enter the password below!', 'tm-beans'));
    $output .= beans_close_markup('beans_password_form_notice', 'p');
    // Form.
    $output .= beans_open_markup('beans_password_form', 'form', array('class' => 'uk-form uk-margin-bottom', 'method' => 'post', 'action' => site_url('wp-login.php?action=postpass', 'login_post')));
    $output .= beans_selfclose_markup('beans_password_form_input', 'input', array('class' => 'uk-margin-small-top uk-margin-small-right', 'type' => 'password', 'placeholder' => apply_filters('beans_password_form_input_placeholder', __('Password', 'tm-beans')), 'name' => 'post_password'));
    $output .= beans_selfclose_markup('beans_password_form_submit', 'input', array('class' => 'uk-button uk-margin-small-top', 'type' => 'submit', 'name' => 'submit', 'value' => esc_attr(apply_filters('beans_password_form_submit_text', __('Submit', 'tm-beans')))));
    $output .= beans_close_markup('beans_password_form', 'form');
    return $output;
}
// Filter.
beans_add_smart_action('post_gallery', 'beans_post_gallery', 10, 3);
/**
 * Modify WP {@link https://codex.wordpress.org/Function_Reference/gallery_shortcode Gallery Shortcode} output.
 *
 * This implements the functionality of the Gallery Shortcode for displaying WordPress images in a post.
 *
 * @since 1.3.0
 *
 * @param string $output   The gallery output. Default empty.
 * @param array  $attr     Attributes of the {@link https://codex.wordpress.org/Function_Reference/gallery_shortcode gallery_shortcode()}.
 * @param int    $instance Unique numeric ID of this gallery shortcode instance.
 *
 * @return string HTML content to display gallery.
 */
function beans_post_gallery($output, $attr, $instance)
{
コード例 #26
0
ファイル: field.php プロジェクト: ThemeButler/tm-demo
 * @param array $field {
 *      Array of data.
 *
 *      @type string $label The field label. Default false.
 * }
 */
function beans_field_label($field)
{
    if (!($label = beans_get('label', $field))) {
        return;
    }
    echo beans_open_markup('beans_field_label', 'label');
    echo $field['label'];
    echo beans_close_markup('beans_field_label', 'label');
}
beans_add_smart_action('beans_field_wrap_append_markup', 'beans_field_description');
/**
 * Echo field description.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      Array of data.
 *
 *      @type string $description The field description. The description can be truncated using <!--more-->
 *            					  as a delimiter. Default false.
 * }
 */
function beans_field_description($field)
{
    if (!($description = beans_get('description', $field))) {
コード例 #27
0
ファイル: fragments.php プロジェクト: Getbeans/Beans
    beans_load_fragment_file('comments');
    return $template;
}
beans_add_smart_action('dynamic_sidebar_before', 'beans_load_widget_fragment', -1);
/**
 * Load widget fragments.
 *
 * The widget fragments only loads if a sidebar is active to prevent unnecessary memory usage.
 *
 * @since 1.0.0
 *
 * @return bool True on success, false on failure.
 */
function beans_load_widget_fragment()
{
    return beans_load_fragment_file('widget');
}
beans_add_smart_action('pre_get_search_form', 'beans_load_search_form_fragment');
/**
 * Load search form fragments.
 *
 * The search form fragments only loads if search is active to prevent unnecessary memory usage.
 *
 * @since 1.0.0
 *
 * @return bool True on success, false on failure.
 */
function beans_load_search_form_fragment()
{
    return beans_load_fragment_file('searchform');
}
コード例 #28
0
ファイル: widget-area.php プロジェクト: KevinFairbanks/Beans
<?php

/**
 * Registers Beans's default widget areas.
 *
 * @package Render\Widgets
 */
beans_add_smart_action('widgets_init', 'beans_do_register_widget_areas', 5);
/**
 * Register Beans's default widget areas.
 *
 * @since 1.0.0
 */
function beans_do_register_widget_areas()
{
    // Keep primary sidebar first for default widget asignment.
    beans_register_widget_area(array('name' => __('Sidebar Primary', 'tm-beans'), 'id' => 'sidebar_primary'));
    beans_register_widget_area(array('name' => __('Sidebar Secondary', 'tm-beans'), 'id' => 'sidebar_secondary'));
    if (current_theme_supports('offcanvas-menu')) {
        beans_register_widget_area(array('name' => __('Off-Canvas Menu', 'tm-beans'), 'id' => 'offcanvas_menu', 'beans_type' => 'offcanvas'));
    }
}
/**
 * Call register sidebar.
 *
 * Because WordPress.org checker don't understand that we are using register_sidebar properly,
 * we have to add this useless call which only has to be declared once.
 *
 * @since 1.0.0
 *
 * @ignore
コード例 #29
0
ファイル: activation.php プロジェクト: ThemeButler/tm-demo
<?php

/**
 * @package Beans\API\Fields\Types
 */
beans_add_smart_action('beans_field_activation', 'beans_field_activation');
/**
 * Echo activation field type.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      For best practices, pass the array of data obtained using {@see beans_get_fields()}.
 *
 *      @type string $description The field description. The description can be truncated using <!--more-->
 *            					  as a delimiter. Default false.
 *      @type mixed  $value       The field value.
 *      @type string $name        The field name value.
 *      @type array  $attributes  An array of attributes to add to the field. The array key defines the
 *            					  attribute name and the array value defines the attribute value. Default array.
 *      @type mixed  $default     The default value. Default false.
 * }
 */
function beans_field_activation($field)
{
    $checked = $field['value'] ? ' checked="checked"' : null;
    echo '<input type="hidden" value="0" name="' . $field['name'] . '" />';
    echo '<input type="checkbox" name="' . $field['name'] . '" value="1" ' . $checked . ' ' . beans_sanatize_attributes($field['attributes']) . ' />';
}
コード例 #30
0
ファイル: radio.php プロジェクト: ThemeButler/tm-demo
<?php

/**
 * @package Beans\API\Fields\Types
 */
beans_add_smart_action('beans_field_radio', 'beans_field_radio');
/**
 * Echo radio field type.
 *
 * @since 1.0.0
 *
 * @param array $field {
 *      For best practices, pass the array of data obtained using {@see beans_get_fields()}.
 *
 *      @type mixed  $value      The field value.
 *      @type string $name       The field name value.
 *      @type array  $attributes An array of attributes to add to the field. The array key defines the
 *            					 attribute name and the array value defines the attribute value. Default array.
 *      @type mixed  $default    The default value. Default false.
 *      @type array  $options    An array used to populate the radio options. The array key defines radio
 *            					 value and the array value defines the radio label or image path.
 * }
 */
function beans_field_radio($field)
{
    if (empty($field['options'])) {
        return;
    }
    $field['default'] = isset($checkbox['default']) ? $checkbox['default'] : key($field['options']);
    echo '<fieldset>';
    $i = 0;