コード例 #1
0
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;
}
コード例 #2
0
ファイル: embed.php プロジェクト: KevinFairbanks/Beans
/**
 * 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;
}
コード例 #3
0
ファイル: post-views.php プロジェクト: kkthemes/kkthemes
function kkthemes_post_content($content)
{
    $output = beans_open_markup('kkthemes_post_content', 'p');
    $output .= beans_output('kkthemes_post_content_summary', kkthemes_get_excerpt($content));
    $output .= beans_close_markup('kkthemes_post_content', 'p');
    $output .= '<p>' . beans_post_more_link() . '</p>';
    return $output;
}
コード例 #4
0
function beans_child_add_hero()
{
    echo beans_open_markup('beans_child_hero_section', 'div', array('class' => 'uk-block uk-block-large uk-container-center uk-text-center bc-block'));
    $hero_content = '<h1 class="uk-heading-large">My Beans</h1>';
    $hero_content .= '<p class="uk-article-lead">A demo theme for SitePoint</p>';
    $hero_content .= '<p><a href="#" class="uk-button uk-button-large">Read Article <i class="uk-icon-external-link"></i></a></p>';
    echo $hero_content;
    echo beans_close_markup('beans_child_hero_section', 'div');
}
コード例 #5
0
ファイル: searchform.php プロジェクト: JoomPassion/Beans
/**
 * Modify the search form.
 *
 * @since 1.0.0
 *
 * @return string The form.
 */
function beans_search_form()
{
    $output = beans_open_markup('beans_search_form', 'form', array('class' => 'uk-form uk-form-icon uk-form-icon-flip uk-width-1-1', 'method' => 'get', 'action' => esc_url(home_url('/')), 'role' => 'search'));
    $output .= beans_selfclose_markup('beans_search_form_input', 'input', array('class' => 'uk-width-1-1', 'type' => 'search', 'placeholder' => __('Search', 'beans'), 'value' => esc_attr(get_search_query()), 'name' => 's'));
    $output .= beans_open_markup('beans_search_form_input_icon', 'i', 'class=uk-icon-search');
    $output .= beans_close_markup('beans_search_form_input_icon', 'i');
    $output .= beans_close_markup('beans_search_form', 'form');
    return $output;
}
コード例 #6
0
ファイル: footer.php プロジェクト: ThemeButler/tm-demo
/**
 * Echo the footer content.
 *
 * @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');
}
コード例 #7
0
ファイル: page_home.php プロジェクト: kkthemes/kkthemes
function kkthemes_site_title_tag()
{
    // Stop here if there isn't a description.
    if (!($description = get_bloginfo('description'))) {
        return;
    }
    $tag_style = '';
    $header_image = get_header_image();
    if (!empty($header_image)) {
        $tag_style = 'background-image: url(' . esc_url($header_image) . ');';
    }
    echo beans_open_markup('kkthemes_site_title_tag', 'div', array('class' => 'tm-site-title-tag tm-branded-panel uk-block uk-margin-large-bottom', 'itemprop' => 'description', 'style' => $tag_style));
    echo beans_output('kkthemes_site_title_tag_text', $description);
    echo beans_close_markup('kkthemes_site_title_tag', 'div');
}
コード例 #8
0
ファイル: field.php プロジェクト: ThemeButler/tm-demo
/**
 * 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))) {
        return;
    }
    echo beans_open_markup('beans_field_description', 'div', array('class' => 'bs-field-description'));
    if (preg_match('#<!--more-->#', $description, $matches)) {
        list($description, $extended) = explode($matches[0], $description, 2);
    }
    echo $description;
    if (isset($extended)) {
        echo '&nbsp;<a class="bs-read-more" href="#">' . __('More...', 'beans') . '</a>';
        echo '<div class="bs-extended-content">' . $extended . '</div>';
    }
    echo beans_close_markup('beans_field_description', 'div');
}
コード例 #9
0
ファイル: menu.php プロジェクト: ThemeButler/tm-demo
/**
 * Modify wp_nav_menu arguments.
 *
 * This function converts the wp_nav_menu to UIKit format. It uses Beans custom walker and also makes
 * use of the Beans HTML API.
 *
 * @since 1.0.0
 *
 * @param array $args The wp_nav_menu arguments.
 *
 * @return array The modified wp_nav_menu arguments.
 */
function beans_modify_menu_args($args)
{
    // Get type.
    $type = beans_get('beans_type', $args);
    // Check if the menu is in a widget area and set the type accordingly if it is defined.
    if ($widget_area_type = beans_get_widget_area('beans_type')) {
        $type = $widget_area_type == 'stack' ? 'sidenav' : $widget_area_type;
    }
    // Stop if it isn't a beans menu.
    if (!$type) {
        return $args;
    }
    // Default item wrap attributes.
    $attr = array('id' => '%1$s', 'class' => array(beans_get('menu_class', $args)));
    // Add UIKit navbar item wrap attributes.
    if ($type == 'navbar') {
        $attr['class'][] = 'uk-navbar-nav';
    }
    // Add UIKit sidenav item wrap attributes.
    if ($type == 'sidenav') {
        $attr['class'][] = 'uk-nav uk-nav-parent-icon uk-nav-side';
        $attr['data-uk-nav'] = '{multiple:true}';
    }
    // Add UIKit offcanvas item wrap attributes.
    if ($type == 'offcanvas') {
        $attr['class'][] = 'uk-nav uk-nav-parent-icon uk-nav-offcanvas';
        $attr['data-uk-nav'] = '{multiple:true}';
    }
    // Implode to avoid empty spaces.
    $attr['class'] = implode(' ', array_filter($attr['class']));
    // Set to null if empty to avoid outputing empty class html attribute.
    if (!$attr['class']) {
        $attr['class'] = null;
    }
    $location_sub_filter = ($location = beans_get('theme_location', $args)) ? "[_{$location}]" : null;
    // Force beans menu arguments.
    $force = array('beans_type' => $type, 'items_wrap' => beans_open_markup("beans_menu[_{$type}]{$location_sub_filter}", 'ul', $attr, $args) . '%3$s' . beans_close_markup("beans_menu[_{$type}]{$location_sub_filter}", 'ul', $args));
    // Allow walker overwrite.
    if (!beans_get('walker', $args)) {
        $args['walker'] = new _Beans_Walker_Nav_Menu();
    }
    // Adapt level to walker depth.
    $force['beans_start_level'] = ($level = beans_get('beans_start_level', $args)) ? $level - 1 : 0;
    return array_merge($args, $force);
}
コード例 #10
0
/**
 * Echo post meta comments shortcode.
 *
 * @since 1.0.0
 */
function beans_post_meta_comments_shortcode()
{
    global $post;
    if (post_password_required() || !comments_open()) {
        return;
    }
    $comments_number = (int) get_comments_number($post->ID);
    if ($comments_number < 1) {
        $comment_text = beans_output('beans_post_meta_empty_comment_text', __('Leave a comment', 'beans'));
    } else {
        if ($comments_number === 1) {
            $comment_text = beans_output('beans_post_meta_comments_text_singular', __('1 comment', 'beans'));
        } else {
            $comment_text = beans_output('beans_post_meta_comments_text_plurial', __('%s comments', 'beans'));
        }
    }
    echo beans_open_markup('beans_post_meta_comments', 'a', array('href' => esc_url(get_comments_link())));
    printf($comment_text, (int) get_comments_number($post->ID));
    echo beans_close_markup('beans_post_meta_comments', 'a');
}
コード例 #11
0
ファイル: header.php プロジェクト: ThemeButler/tm-demo
/**
 * 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');
}
コード例 #12
0
     echo beans_open_markup('woo_single_add_to_cart_variable_label_cell', 'td', array('class' => 'label'));
     echo beans_open_markup('woo_single_add_to_cart_variable_label', 'label', array('for' => sanitize_title($attribute_name)));
     echo wc_attribute_label($attribute_name);
     echo beans_open_markup('woo_single_add_to_cart_variable_label', 'label');
     echo beans_close_markup('woo_single_add_to_cart_variable_label_td', 'td');
     echo beans_open_markup('woo_single_add_to_cart_variable_value_cell', 'td', array('class' => 'value'));
     $selected = isset($_REQUEST['attribute_' . sanitize_title($attribute_name)]) ? wc_clean($_REQUEST['attribute_' . sanitize_title($attribute_name)]) : $product->get_variation_default_attribute($attribute_name);
     wc_dropdown_variation_attribute_options(array('options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected));
     echo end($attribute_keys) === $attribute_name ? beans_open_markup('woo_single_add_to_cart_remove_variation_link', 'a', array('class' => 'reset_variations', 'href' => '#')) . __('Clear selection', 'woocommerce') . beans_close_markup('woo_single_add_to_cart_remove_variation_link', 'a') : '';
     echo beans_close_markup('woo_single_add_to_cart_variable_value_cell', 'td');
     echo beans_close_markup('woo_single_add_to_cart_variable_tr', 'tr');
 }
 echo beans_close_markup('woo_single_add_to_cart_variable_tbody', 'tbody');
 echo beans_close_markup('woo_single_add_to_cart_variable_table', 'table');
 do_action('woocommerce_before_add_to_cart_button');
 echo beans_open_markup('woo_single_add_to_cart_single_variation_wrap', 'div', array('class' => 'single_variation_wrap', 'style' => 'display:none;'));
 /**
  * woocommerce_before_single_variation Hook
  */
 do_action('woocommerce_before_single_variation');
 /**
  * woocommerce_single_variation hook. Used to output the cart button and placeholder for variation data.
  * @since 2.4.0
  * @hooked woocommerce_single_variation - 10 Empty div for variation data.
  * @hooked woocommerce_single_variation_add_to_cart_button - 20 Qty and cart button.
  */
 do_action('woocommerce_single_variation');
 /**
  * woocommerce_after_single_variation Hook
  */
 do_action('woocommerce_after_single_variation');
コード例 #13
0
ファイル: post.php プロジェクト: Getbeans/Beans
/**
 * 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)
{
    $post = get_post();
    $html5 = current_theme_supports('html5', 'gallery');
    $defaults = array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'itemtag' => $html5 ? 'figure' : 'dl', 'icontag' => $html5 ? 'div' : 'dt', 'captiontag' => $html5 ? 'figcaption' : 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'link' => '');
    $atts = shortcode_atts($defaults, $attr, 'gallery');
    $id = intval($atts['id']);
    // Set attachements.
    if (!empty($atts['include'])) {
        $_attachments = get_posts(array('include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($atts['exclude'])) {
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
    }
    // Stop here if no attachment.
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $atts['size'], true) . "\n";
        }
        return $output;
    }
    // Valid tags.
    $valid_tags = wp_kses_allowed_html('post');
    $validate = array('itemtag', 'captiontag', 'icontag');
    // Validate tags.
    foreach ($validate as $tag) {
        if (!isset($valid_tags[$atts[$tag]])) {
            $atts[$tag] = $defaults[$tag];
        }
    }
    // Set variables used in the output.
    $columns = intval($atts['columns']);
    $size_class = sanitize_html_class($atts['size']);
    // WP adds the opening div in the gallery_style filter (weird), so we follow it as don't want to break people's site.
    $gallery_div = beans_open_markup("beans_post_gallery[_{$id}]", 'div', array('class' => "uk-grid uk-grid-width-small-1-{$columns} gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}", 'data-uk-grid-margin' => false), $id, $columns);
    /**
     * Apply WP core filter. Filter the default gallery shortcode CSS styles.
     *
     * Documented in WordPress.
     *
     * @ignore
     */
    $output = apply_filters('gallery_style', $gallery_div);
    $i = 0;
    foreach ($attachments as $attachment_id => $attachment) {
        $attr = trim($attachment->post_excerpt) ? array('aria-describedby' => "gallery-{$instance}-{$id}") : '';
        $image_meta = wp_get_attachment_metadata($attachment_id);
        $orientation = '';
        if (isset($image_meta['height'], $image_meta['width'])) {
            $orientation = $image_meta['height'] > $image_meta['width'] ? 'portrait' : 'landscape';
        }
        // Set the image output.
        if ('none' === $atts['link']) {
            $image_output = wp_get_attachment_image($attachment_id, $atts['size'], false, $attr);
        } else {
            $image_output = wp_get_attachment_link($attachment_id, $atts['size'], 'file' !== $atts['link'], false, false, $attr);
        }
        $output .= beans_open_markup("beans_post_gallery_item[_{$attachment_id}]", $atts['itemtag'], array('class' => 'gallery-item'));
        $output .= beans_open_markup("beans_post_gallery_icon[_{$attachment_id}]", $atts['icontag'], array('class' => "gallery-icon {$orientation}"));
        // Automatically escaped.
        $output .= beans_output("beans_post_gallery_icon[_{$attachment_id}]", $image_output, $attachment_id, $atts);
        $output .= beans_close_markup("beans_post_gallery_icon[_{$attachment_id}]", $atts['icontag']);
        if ($atts['captiontag'] && trim($attachment->post_excerpt)) {
            $output .= beans_open_markup("beans_post_gallery_caption[_{$attachment_id}]", $atts['captiontag'], array('class' => 'wp-caption-text gallery-caption'));
            $output .= beans_output("beans_post_gallery_caption_text[_{$attachment_id}]", wptexturize($attachment->post_excerpt));
            $output .= beans_close_markup("beans_post_gallery_caption[_{$attachment_id}]", $atts['captiontag']);
        }
        $output .= beans_close_markup("beans_post_gallery_item[_{$attachment_id}]", $atts['itemtag']);
    }
    $output .= beans_close_markup("beans_post_gallery[_{$id}]", 'div');
    return $output;
}
コード例 #14
0
 * @version 2.4.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
/**
 * Filter tabs and allow third parties to add their own
 *
 * Each tab is an array containing title, callback and priority.
 * @see woocommerce_default_product_tabs()
 */
$tabs = apply_filters('woocommerce_product_tabs', array());
if (!empty($tabs)) {
    echo beans_open_markup('woo_product_single_tabs_wrap', 'div', array('class' => 'woocommerce-tabs wc-tabs-wrapper'));
    echo beans_open_markup('woo_product_single_tabs_wrap_list', 'ul', array('class' => 'tabs wc-tabs'));
    foreach ($tabs as $key => $tab) {
        echo beans_open_markup('woo_product_single_tabs_wrap_list_item', 'li', array('class' => esc_attr($key) . '_tab'));
        echo beans_open_markup('woo_product_single_tabs_wrap_list_item_link', 'a', array('href' => '#tab-' . esc_attr($key)));
        echo apply_filters('woocommerce_product_' . $key . '_tab_title', esc_html($tab['title']), $key);
        echo beans_close_markup('woo_product_single_tabs_wrap_list_item_link', 'a');
        echo beans_close_markup('woo_product_single_tabs_wrap_list_item', 'li');
    }
    echo beans_close_markup('woo_product_single_tabs_wrap_list', 'ul');
    foreach ($tabs as $key => $tab) {
        echo beans_open_markup('woo_product_single_tabs_wrap_tab', 'div', array('class' => 'panel entry-content wc-tab', 'id' => 'tab-' . esc_attr($key)));
        call_user_func($tab['callback'], $key, $tab);
        echo beans_close_markup('woo_product_single_tabs_wrap_tab', 'div');
    }
    echo beans_close_markup('woo_product_single_tabs_wrap', 'div');
}
コード例 #15
0
ファイル: comments.php プロジェクト: KevinFairbanks/Beans
/**
 * Echo the structural markup that wraps around comments. It also calls the comments action hooks.
 *
 * This template will return empty if the post which is called is password protected.
 *
 * @package Structure\Comments
 */
// Stop here if the post is password protected.
if (post_password_required()) {
    return;
}
echo beans_open_markup('beans_comments', 'div', array('id' => 'comments', 'class' => 'tm-comments' . (current_theme_supports('beans-default-styling') ? ' uk-panel-box' : null)));
if (comments_open(get_the_ID())) {
    if (have_comments()) {
        echo beans_open_markup('beans_comments_list', 'ol', array('class' => 'uk-comment-list'));
        wp_list_comments(array('avatar_size' => 50, 'callback' => 'beans_comment_callback'));
        echo beans_close_markup('beans_comments_list', 'ol');
    } else {
        /**
         * Fires if no comments exist.
         *
         * This hook only fires if comments are open.
         *
         * @since 1.0.0
         */
        do_action('beans_no_comment');
    }
    /**
     * Fires after the comments list.
     *
コード例 #16
0
ファイル: walker.php プロジェクト: ThemeButler/tm-demo
 /**
  * Extend WordPress start menu elements.
  *
  * @ignore
  */
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     // Stop here if the depth is smaller than starting depth.
     if ($depth < $args->beans_start_level) {
         return;
     }
     $item_id = $item->ID;
     // Wp item attributes.
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = 'menu-item-' . $item->ID;
     $_classes = join(' ', (array) apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
     // WP link attributes.
     $_link_attr = array('title' => $item->attr_title, 'target' => $item->target, 'rel' => $item->xfn, 'href' => $item->url);
     // Prevent empty WP link attributes.
     foreach ($_link_attr as $attr => $value) {
         if (!empty($value)) {
             $link_attr[$attr] = $value;
         }
     }
     $link_attr = apply_filters('nav_menu_link_attributes', $link_attr, $item, $args);
     // Set wp item attributes as defaults.
     $item_attr = array('class' => array($_classes));
     // Add UIKit active class.
     if (in_array('current-menu-item', $classes)) {
         $item_attr['class'][] = 'uk-active';
     }
     // Add UIKit parent attributes.
     if ($depth == $args->beans_start_level && in_array('menu-item-has-children', $classes)) {
         $item_attr['class'][] = 'uk-parent';
         if (beans_get('beans_type', $args) == 'navbar') {
             $item_attr['data-uk-dropdown'] = '';
             $child_indicator = true;
         }
     }
     // Implode to avoid empty spaces.
     $item_attr['class'] = implode(' ', array_filter($item_attr['class']));
     // Set to null if empty to avoid outputing empty class html attribute.
     if (!$item_attr['class']) {
         $item_attr['class'] = null;
     }
     $output .= beans_open_markup("beans_menu_item[_{$item_id}]", 'li', $item_attr, $item, $depth, $args);
     $item_output = $args->before;
     $item_output .= beans_open_markup("beans_menu_item_link[_{$item_id}]", 'a', $link_attr, $item, $depth, $args);
     $item_output .= beans_output("beans_menu_item_text[_{$item_id}]", $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after);
     if (isset($child_indicator)) {
         $item_output .= beans_open_markup("beans_menu_item_child_indicator[_{$item_id}]", 'i', array('class' => 'uk-icon-caret-down uk-margin-small-left'), $item, $depth, $args);
         $item_output .= beans_close_markup("beans_menu_item_child_indicator[_{$item_id}]", 'i', $item, $depth, $args);
     }
     $item_output .= beans_close_markup("beans_menu_item_link[_{$item_id}]", 'a', $link_attr, $item, $depth, $args);
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
コード例 #17
0
<?php

/**
 * Single Product Price, including microdata for SEO
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $product;
echo beans_open_markup('woo_single_price_wrap', 'div', array('itemprop' => 'offers', 'itemscope' => '', 'itemtype' => 'http://schema.org/Offer'));
echo beans_open_markup('woo_single_price_p', 'p', array('class' => 'price'));
echo $product->get_price_html();
echo beans_close_markup('woo_single_price_p', 'p');
echo beans_selfclose_markup('woo_single_price_meta_price', 'meta', array('itemprop' => 'price', 'content' => esc_attr($product->get_price())));
echo beans_selfclose_markup('woo_single_price_meta_currency', 'meta', array('itemprop' => 'priceCurrency', 'content' => esc_attr(get_woocommerce_currency())));
echo beans_selfclose_markup('woo_single_price_meta_link', 'link', array('itemprop' => 'availability', 'href' => 'http://schema.org/' . $product->is_in_stock() ? 'InStock' : 'OutOfStock'));
echo beans_close_markup('woo_single_price_wrap', 'div');
コード例 #18
0
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.1.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $product;
if (!$product->is_purchasable()) {
    return;
}
// Availability
$availability = $product->get_availability();
$availability_html = empty($availability['availability']) ? '' : beans_open_markup('woo_single_add_to_cart_grouped_availability', 'p', array('class' => 'stock')) . esc_attr($availability['class']) . '">' . esc_html($availability['availability']) . beans_close_markup('woo_single_add_to_cart_grouped_availability', 'p');
echo apply_filters('woocommerce_stock_html', $availability_html, $availability['availability'], $product);
if ($product->is_in_stock()) {
    do_action('woocommerce_before_add_to_cart_form');
    echo beans_open_markup('woo_single_add_to_cart_simple_form', 'form', array('class' => 'cart', 'method' => 'post', 'enctype' => 'multipart/form-data'));
    do_action('woocommerce_before_add_to_cart_button');
    if (!$product->is_sold_individually()) {
        woocommerce_quantity_input(array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product), 'input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
    }
    echo beans_selfclose_markup('woo_single_add_to_cart_simple_input_hidden', 'input', array('type' => 'hidden', 'name' => 'add-to-cart', 'value' => esc_attr($product->id)));
    echo beans_open_markup('woo_single_add_to_cart_simple_submit_button', 'button', array('type' => 'submit', 'class' => 'single_add_to_cart_button button alt'));
    echo esc_html($product->single_add_to_cart_text());
    echo beans_close_markup('woo_single_add_to_cart_grouped_tbody_submit_button', 'button');
    do_action('woocommerce_after_add_to_cart_button');
    echo beans_close_markup('woo_single_add_to_cart_simple_form', 'form');
    do_action('woocommerce_after_add_to_cart_form');
}
コード例 #19
0
ファイル: post.php プロジェクト: ThemeButler/tm-demo
/**
 * 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');
    // Form.
    $output .= beans_open_markup('beans_password_form', 'form', array('class' => 'uk-form uk-margin-bottom', 'method' => 'post', 'action' => esc_url(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' => esc_attr(apply_filters('beans_password_form_input_placeholder', __('Password', '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', 'beans')))));
    $output .= beans_close_markup('beans_password_form', 'form');
    return $output;
}
コード例 #20
0
ファイル: menu.php プロジェクト: JoomPassion/Beans
/**
 * Echo no menu notice.
 *
 * @since 1.0.0
 */
function beans_no_menu_notice()
{
    echo beans_open_markup('beans_no_menu_notice', 'p', array('class' => 'uk-alert uk-alert-warning'));
    echo beans_output('beans_no_menu_notice_text', __('Whoops, your site does not have a menu!', 'beans'));
    echo beans_close_markup('beans_no_menu_notice', 'p');
}
 */
do_action('woocommerce_before_single_product');
if (post_password_required()) {
    echo get_the_password_form();
    return;
}
echo beans_open_markup('woo_product_single_wrap', 'div', array('itemscope' => '', 'itemtype' => woocommerce_get_product_schema(), 'id' => 'product-' . get_the_ID(), 'class' => implode(' ', post_class())));
#TODO Double check
/**
 * woocommerce_before_single_product_summary hook
 *
 * @hooked woocommerce_show_product_sale_flash - 10
 * @hooked woocommerce_show_product_images - 20
 */
do_action('woocommerce_before_single_product_summary');
echo beans_open_markup('woo_product_single_summary', 'div', array('class' => 'summary entry-summary'));
/**
 * woocommerce_single_product_summary hook
 *
 * @hooked woocommerce_template_single_title - 5
 * @hooked woocommerce_template_single_rating - 10
 * @hooked woocommerce_template_single_price - 10
 * @hooked woocommerce_template_single_excerpt - 20
 * @hooked woocommerce_template_single_add_to_cart - 30
 * @hooked woocommerce_template_single_meta - 40
 * @hooked woocommerce_template_single_sharing - 50
 */
do_action('woocommerce_single_product_summary');
echo beans_close_markup('woo_product_single_summary', 'div');
/**
 * woocommerce_after_single_product_summary hook
コード例 #22
0
ファイル: widget-area.php プロジェクト: ThemeButler/tm-demo
// Widgets.
if (beans_have_widgets()) {
    /**
     * Fires before widgets loop.
     *
     * This hook only fires if widgets exist.
     *
     * @since 1.0.0
     */
    do_action('beans_before_widgets_loop');
    while (beans_have_widgets()) {
        beans_setup_widget();
        if (beans_get_widget_area('beans_type') == 'grid') {
            echo beans_open_markup('beans_widget_grid' . _beans_widget_subfilters(), 'div', beans_widget_shortcodes('class=uk-width-medium-1-{count}'));
        }
        echo beans_open_markup('beans_widget_panel' . _beans_widget_subfilters(), 'div', beans_widget_shortcodes('class=tm-widget uk-panel widget_{type} {id}'));
        /**
         * Fires in each widget panel structural HTML.
         *
         * @since 1.0.0
         */
        do_action('beans_widget');
        echo beans_close_markup('beans_widget_panel' . _beans_widget_subfilters(), 'div');
        if (beans_get_widget_area('beans_type') == 'grid') {
            echo beans_close_markup('beans_widget_grid' . _beans_widget_subfilters(), 'div');
        }
    }
    /**
     * Fires after the widgets loop.
     *
     * This hook only fires if widgets exist.
コード例 #23
0
ファイル: widget.php プロジェクト: KevinFairbanks/Beans
/**
 * Modify widget count.
 *
 * @since 1.0.0
 *
 * @param string $content The widget content.
 *
 * @return string The modified widget content.
 */
function beans_modify_widget_count($content)
{
    $count = beans_output('beans_widget_count', '$1');
    if (beans_get('dropdown', beans_get_widget('options')) == true) {
        $output = $count;
    } else {
        $output = beans_open_markup('beans_widget_count', 'span', 'class=tm-count');
        $output .= $count;
        $output .= beans_close_markup('beans_widget_count', 'span');
    }
    // Keep closing tag to avoid overwriting the inline JavaScript.
    return preg_replace('#>((\\s|&nbsp;)\\((.*)\\))#', '>' . $output, $content);
}
コード例 #24
0
            $no_gateways_message = __('Please fill in your details above to see available payment methods.', 'woocommerce');
        } else {
            $no_gateways_message = __('Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce');
        }
        echo beans_open_markup('woo_checkout_no_available_payment_methods_message', 'li');
        echo apply_filters('woocommerce_no_available_payment_methods_message', $no_gateways_message);
        echo beans_close_markup('woo_checkout_no_available_payment_methods_message', 'li');
    }
    echo beans_close_markup('woo_checkout_payment_method_wrap_list', 'ul');
}
echo beans_open_markup('woo_checkout_place_order_wrap', 'div', array('class' => 'form-row place-order'));
echo '<noscript>';
_e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce');
echo '<br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="' . __('Update totals', 'woocommerce') . '" /></noscript>';
wp_nonce_field('woocommerce-process_checkout');
do_action('woocommerce_review_order_before_submit');
echo apply_filters('woocommerce_order_button_html', beans_selfclose_markup('woo_order_button_html', 'input', array('type' => 'submit', 'class' => 'button alt', 'name' => 'woocommerce_checkout_place_order', 'id' => 'place_order', 'value' => esc_attr($order_button_text), 'data-value' => esc_attr($order_button_text))));
if (wc_get_page_id('terms') > 0 && apply_filters('woocommerce_checkout_show_terms', true)) {
    echo beans_open_markup('woo_checkout_order_terms', 'p', array('class' => 'form-row terms'));
    echo beans_open_markup('woo_checkout_order_terms_label', 'label', array('for' => 'terms', 'class' => 'checkbox'));
    printf(__('I&rsquo;ve read and accept the ' . beans_open_markup('woo_checkout_terms_link', 'a', array('href' => '%s', 'target' => '_blank')) . 'terms &amp; conditions', 'woocommerce') . beans_close_markup('woo_checkout_terms_link', 'a'), esc_url(wc_get_page_permalink('terms')));
    echo beans_close_markup('woo_checkout_order_terms_label', 'label');
    echo beans_selfclose_markup('woo_checkout_order_terms_input', 'input', array('type' => 'checkbox', 'class' => 'input-checkbox', 'name' => 'terms', 'checked' => checked(apply_filters('woocommerce_terms_is_checked_default', isset($_POST['terms'])), true), 'id' => 'terms'));
    echo beans_close_markup('woo_checkout_order_terms', 'p');
}
do_action('woocommerce_review_order_after_submit');
echo beans_close_markup('woo_checkout_place_order_wrap', 'div');
echo beans_close_markup('woo_checkout_payment_method_wrap', 'div');
if (!is_ajax()) {
    do_action('woocommerce_review_order_after_payment');
}
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $post, $product, $woocommerce;
$attachment_ids = $product->get_gallery_attachment_ids();
if ($attachment_ids) {
    $loop = 0;
    $columns = apply_filters('woocommerce_product_thumbnails_columns', 3);
    echo beans_open_markup('woo_product_single_thumbs_wrap', 'div', array('class' => 'thumbnails columns-' . $columns));
    foreach ($attachment_ids as $attachment_id) {
        $classes = array('zoom');
        if ($loop == 0 || $loop % $columns == 0) {
            $classes[] = 'first';
        }
        if (($loop + 1) % $columns == 0) {
            $classes[] = 'last';
        }
        $image_link = wp_get_attachment_url($attachment_id);
        if (!$image_link) {
            continue;
        }
        $image_title = esc_attr(get_the_title($attachment_id));
        $image_caption = esc_attr(get_post_field('post_excerpt', $attachment_id));
        $image = wp_get_attachment_image($attachment_id, apply_filters('single_product_small_thumbnail_size', 'shop_thumbnail'), 0, $attr = array('title' => $image_title, 'alt' => $image_title));
        $image_class = esc_attr(implode(' ', $classes));
        echo apply_filters('woocommerce_single_product_image_thumbnail_html', sprintf(beans_open_markup('woo_product_single_thumb_link', 'a', array('href' => '%s', 'class' => '%s', 'title' => '%s', 'data-rel' => 'prettyPhoto[product-gallery]')) . '%s' . beans_close_markup('woo_product_single_thumb_link', 'a'), $image_link, $image_class, $image_caption, $image), $attachment_id, $post->ID, $image_class);
        $loop++;
    }
    echo beans_close_markup('woo_product_single_thumbs_wrap', 'div');
}
コード例 #26
0
ファイル: header.php プロジェクト: ThemeButler/tm-demo
echo beans_output('beans_doctype', '<!DOCTYPE html>');
echo beans_open_markup('beans_html', 'html', str_replace(' ', '&', str_replace('"', '', beans_render_function('language_attributes'))));
echo beans_open_markup('beans_head', 'head');
/**
 * Fires in the head.
 *
 * This hook fires in the head HTML section, not in wp_header().
 *
 * @since 1.0.0
 */
do_action('beans_head');
// Keep if for plugins.
wp_head();
echo beans_close_markup('beans_head', 'head');
echo beans_open_markup('beans_body', 'body', array('class' => implode(' ', get_body_class('uk-form no-js'))));
echo beans_open_markup('beans_site', 'div', array('class' => 'tm-site'));
echo beans_open_markup('beans_header', 'header', array('class' => 'tm-header uk-block', 'role' => 'banner'));
echo beans_open_markup('beans_fixed_wrap[_header]', 'div', 'class=uk-container uk-container-center');
/**
 * Fires in the header.
 *
 * @since 1.0.0
 */
do_action('beans_header');
echo beans_close_markup('beans_fixed_wrap[_header]', 'div');
echo beans_close_markup('beans_header', 'header');
echo beans_open_markup('beans_main', 'main', array('class' => 'tm-main uk-block'));
echo beans_open_markup('beans_fixed_wrap[_main]', 'div', 'class=uk-container uk-container-center');
echo beans_open_markup('beans_main_grid', 'div', array('class' => 'uk-grid', 'data-uk-grid-margin' => ''));
echo beans_open_markup('beans_primary', 'div', array('class' => 'tm-primary ' . beans_get_layout_class('content')));
コード例 #27
0
<?php

/**
 * Single Product Meta
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $post, $product;
$cat_count = sizeof(get_the_terms($post->ID, 'product_cat'));
$tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
echo beans_open_markup('woo_single_meta_wrap', 'div', array('class' => 'product_meta'));
do_action('woocommerce_product_meta_start');
if (wc_product_sku_enabled() && ($product->get_sku() || $product->is_type('variable'))) {
    echo beans_open_markup('woo_single_meta_sku_wrap', 'span', array('class' => 'sku_wrapper'));
    _e('SKU: ', 'woocommerce');
    echo beans_open_markup('woo_single_meta_sku', 'span', array('class' => 'sku', 'itemprop' => 'sku'));
    echo ($sku = $product->get_sku()) ? $sku : __('N/A', 'woocommerce') . ' ';
    echo beans_close_markup('woo_single_meta_sku', 'span');
    echo beans_close_markup('woo_single_meta_sku_wrap', 'span');
}
echo $product->get_categories(', ', beans_open_markup('woo_single_meta_category', 'span', array('class' => 'posted_in')) . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', beans_close_markup('woo_single_meta_category', 'span'));
echo ' ';
echo $product->get_tags(', ', beans_open_markup('woo_single_meta_tags', 'span', array('class' => 'tagged_as')) . _n('Tag:', 'Tags:', $tag_count, 'woocommerce') . ' ', beans_close_markup('woo_single_meta_tags', 'span'));
do_action('woocommerce_product_meta_end');
echo beans_close_markup('woo_single_meta_wrap', 'div');
コード例 #28
0
ファイル: comments.php プロジェクト: MatRouault/Beans
/**
 * Modify comment form fields.
 *
 * This function replaces the default WordPress comment fields.
 *
 * @since 1.0.0
 *
 * @param array $fields The WordPress default fields.
 *
 * @return array The modified fields.
 */
function beans_comment_form_fields($fields)
{
    $commenter = wp_get_current_commenter();
    // Author.
    $author = beans_open_markup('beans_comment_form[_name]', 'div', array('class' => 'uk-width-medium-1-3'));
    /**
     * Filter whether the comment form name legend should load or not.
     *
     * @since 1.0.0
     */
    if (beans_apply_filters('beans_comment_form_legend[_name]', true)) {
        $author .= beans_open_markup('beans_comment_form_legend[_name]', 'legend');
        $author .= beans_output('beans_comment_form_legend_text[_name]', __('Name', 'tm-beans'));
        $author .= beans_close_markup('beans_comment_form_legend[_name]', 'legend');
    }
    $author .= beans_selfclose_markup('beans_comment_form_field[_name]', 'input', array('id' => 'author', 'class' => 'uk-width-1-1', 'type' => 'text', 'value' => esc_attr($commenter['comment_author']), 'name' => 'author'));
    $author .= beans_close_markup('beans_comment_form[_name]', 'div');
    // Email.
    $email = beans_open_markup('beans_comment_form[_email]', 'div', array('class' => 'uk-width-medium-1-3'));
    /**
     * Filter whether the comment form email legend should load or not.
     *
     * @since 1.0.0
     */
    if (beans_apply_filters('beans_comment_form_legend[_email]', true)) {
        $email .= beans_open_markup('beans_comment_form_legend[_email]', 'legend');
        $email .= beans_output('beans_comment_form_legend_text[_email]', sprintf(__('Email %s', 'tm-beans'), get_option('require_name_email') ? ' *' : ''));
        $email .= beans_close_markup('beans_comment_form_legend[_email]', 'legend');
    }
    $email .= beans_selfclose_markup('beans_comment_form_field[_email]', 'input', array('id' => 'email', 'class' => 'uk-width-1-1', 'type' => 'text', 'value' => esc_attr($commenter['comment_author_email']), 'name' => 'email', 'required' => get_option('require_name_email') ? '' : null));
    $email .= beans_close_markup('beans_comment_form[_email]', 'div');
    // 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;
}
コード例 #29
0
<?php

/**
 * Single Product Sale Flash
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $post, $product;
if ($product->is_on_sale()) {
    echo apply_filters('woocommerce_sale_flash', beans_open_markup('woo_sale_flash_badge', 'span', array('class' => 'onsale')) . __('Sale!', 'woocommerce') . beans_close_markup('woo_sale_flash_badge', 'span'), $post, $product);
}
コード例 #30
0
    $order_status_text .= ' ' . __('and was completed', 'woocommerce') . ' ' . human_time_diff(strtotime($order->completed_date), current_time('timestamp')) . __(' ago', 'woocommerce');
}
$order_status_text .= '.';
echo wpautop(esc_attr(apply_filters('woocommerce_order_tracking_status', $order_status_text, $order)));
$notes = $order->get_customer_order_notes();
if ($notes) {
    echo beans_open_markup('woo_order_tracking_title', 'h2');
    _e('Order Updates', 'woocommerce');
    echo beans_close_markup('woo_order_tracking_title', 'h2');
    echo beans_open_markup('woo_order_tracking_list', 'ol', array('class' => 'commentlist notes'));
    foreach ($notes as $note) {
        echo beans_open_markup('woo_order_tracking_list_item', 'li', array('class' => 'comment note'));
        echo beans_open_markup('woo_order_tracking_comment_container', 'div', array('class' => 'comment_container'));
        echo beans_open_markup('woo_order_tracking_comment_text', 'div', array('class' => 'comment-text'));
        echo beans_open_markup('woo_order_tracking_comment_meta', 'p', array('class' => 'meta'));
        echo date_i18n(__('l jS \\o\\f F Y, h:ia', 'woocommerce'), strtotime($note->comment_date));
        echo beans_close_markup('woo_order_tracking_comment_meta', 'p');
        echo beans_open_markup('woo_order_tracking_comment_description', 'div', array('class' => 'description'));
        echo wpautop(wptexturize(wp_kses_post($note->comment_content)));
        echo beans_close_markup('woo_order_tracking_comment_description', 'div');
        echo beans_open_markup('woo_order_tracking_clear', 'div', array('class' => 'clear'));
        echo beans_close_markup('woo_order_tracking_clear', 'div');
        echo beans_open_markup('woo_order_tracking_comment_text', 'div', array('class' => 'comment-text'));
        echo beans_open_markup('woo_order_tracking_clear', 'div', array('class' => 'clear'));
        echo beans_close_markup('woo_order_tracking_clear', 'div');
        echo beans_open_markup('woo_order_tracking_comment_container', 'div', array('class' => 'comment_container'));
        echo beans_open_markup('woo_order_tracking_comment_list_item', 'li', array('class' => 'comment note'));
    }
    echo beans_close_markup('woo_order_tracking_comment_list', 'ol');
}
do_action('woocommerce_view_order', $order->id);