当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_list_filter函数代码示例

本文整理汇总了PHP中wp_list_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_list_filter函数的具体用法?PHP wp_list_filter怎么用?PHP wp_list_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_list_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle_private_loggedin_multisite

 protected function handle_private_loggedin_multisite($options)
 {
     if (is_multisite() && $options['aioi_ms_requiremember'] && !is_network_admin()) {
         // Need to check logged-in user is a member of this sub-site
         $blogs = get_blogs_of_user(get_current_user_id());
         if (!wp_list_filter($blogs, array('userblog_id' => get_current_blog_id()))) {
             // Not a member
             $blog_name = get_bloginfo('name');
             $output = '<p>' . esc_html(sprintf('You attempted to access the "%1$s" sub-site, but you are not currently a member of this site. If you believe you should be able to access "%1$s", please contact your network administrator.', $blog_name)) . '</p>';
             if (!empty($blogs)) {
                 $output .= '<p>You <i>are</i> a member of the following sites:</p>';
                 $output .= '<table>';
                 foreach ($blogs as $blog) {
                     $output .= "<tr>";
                     $output .= "<td valign='top'>";
                     $output .= "<a href='" . esc_url(get_home_url($blog->userblog_id)) . "'>" . esc_html($blog->blogname) . "</a>";
                     $output .= "</td>";
                     $output .= "</tr>";
                 }
                 $output .= '</table>';
             }
             wp_die($output);
         }
     }
 }
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:25,代码来源:premium_all_in_one_intranet.php

示例2: myplugin_save_postdata

function myplugin_save_postdata($post_id)
{
    if (!isset($_POST['myplugin_noncename'])) {
        return $post_id;
    }
    if (!wp_verify_nonce($_POST['myplugin_noncename'], plugin_basename(__FILE__))) {
        return $post_id;
    }
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    $post_type = isset($_POST['post_type']) ? $_POST['post_type'] : '';
    $post_types = wp_list_filter(get_post_types(array('public' => true)), array('attachment'), 'NOT');
    if (in_array($post_type, $post_types)) {
        if (!current_user_can('edit_' . $post_type, $post_id)) {
            return $post_id;
        }
    } else {
        return $post_id;
    }
    $mydata = isset($_POST['dmm_id']) ? $_POST['dmm_id'] : '';
    if (!empty($mydata)) {
        update_post_meta($post_id, 'dmm_id', $mydata);
    } else {
        delete_post_meta($post_id, 'dmm_id');
    }
    return $mydata;
}
开发者ID:yeti-tech,项目名称:DMM_API,代码行数:28,代码来源:add-video-info.php

示例3: get_settings

 public static function get_settings($settings)
 {
     // Insert before miscellaneous settings
     $misc_section_start = wp_list_filter($settings, array('id' => 'woocommerce_subscriptions_miscellaneous', 'type' => 'title'));
     $spliced_array = array_splice($settings, key($misc_section_start), 0, array(array('name' => __('Skip One', 'woocommerce-skip-one'), 'type' => 'title', 'desc' => __('Allow your customers to skip a subscription rather than cancelling it and pickup the subscription again after X amount of the subscription period.', 'woocommerce-skip-one'), 'id' => 'woocommerce_skip_one'), array('name' => __('Cancel/Skip Button Text', 'woocommerce-skip-one'), 'desc' => __('By default, "Cancel/Skip". Customise the new "Cancel" action button text to how you like.', 'woocommerce-skip-one'), 'tip' => '', 'id' => 'woocommerce_skip_one_cancel_skip_button_text', 'css' => 'min-width:300px;', 'default' => __('Cancel/Skip', 'woocommerce-skip-one'), 'type' => 'text', 'desc_tip' => true), array('name' => __('Cancel Subscription Button Text', 'woocommerce-skip-one'), 'desc' => __('By default, "Cancel Subscription". Customise the cancel button text to how you like.', 'woocommerce-skip-one'), 'tip' => '', 'id' => 'woocommerce_skip_one_cancel_button_text', 'css' => 'min-width:300px;', 'default' => __('Cancel Subscription', 'woocommerce-skip-one'), 'type' => 'text', 'desc_tip' => true), array('name' => __('Cancel Subscription Message', 'woocommerce-skip-one'), 'desc' => __('Enter a custom message to your customers if they still wish to cancel their subscription.', 'woocommerce-skip-one'), 'tip' => '', 'id' => 'woocommerce_skip_one_cancel_message', 'css' => 'min-width:480px; min-height:120px;', 'default' => __('We\'re bummed if you have to go, but we understand. Please note: You will still receive your remaining subscription owed.', 'woocommerce-skip-one'), 'type' => 'textarea', 'desc_tip' => true), array('name' => __('Minimum Cost', 'woocommerce-skip-one'), 'desc' => __('Only subscriptions that cost this amount or higher can be allowed to skip a subscription. Leave blank to disable this option.', 'woocommerce-skip-one'), 'tip' => '', 'id' => 'woocommerce_skip_one_minium_sub_value', 'css' => 'min-width:300px;', 'default' => '30', 'type' => 'number', 'desc_tip' => true), array('name' => __('Allow specific periods', 'woocommerce-skip-one'), 'desc' => __('Choose which periods a subscription must be on in order for a customer to skip the subscription.', 'woocommerce-skip-one'), 'id' => 'woocommerce_skip_one_allow_periods', 'css' => 'min-width:120px;', 'default' => 'month', 'type' => 'multiselect', 'class' => 'wc-enhanced-select', 'options' => array('day' => __('Day', 'woocommerce-skip-one'), 'week' => __('Week', 'woocommerce-skip-one'), 'month' => __('Month', 'woocommerce-skip-one'), 'year' => __('Year', 'woocommerce-skip-one')), 'desc_tip' => false), array('name' => __('Stop skipping Free Trials?', 'woocommerce-skip-one'), 'desc' => __('Enable this and any subscription that has a free trial will stop customers from skipping.', 'woocommerce-skip-one'), 'id' => 'woocommerce_skip_one_deny_free_trials', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('name' => __('Allow Unskipping?', 'woocommerce-skip-one'), 'desc' => __('Enable this and your customers can unskip a subscription they skipped.', 'woocommerce-skip-one'), 'id' => 'woocommerce_skip_one_can_customer_unskip', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('name' => __('Allow Cancel Confirmation?', 'woocommerce-skip-one'), 'desc' => __('Enable this and your customers can confirm if they wish to cancel a subscription.', 'woocommerce-skip-one'), 'id' => 'woocommerce_skip_one_can_customer_confirm', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'woocommerce_skip_one')));
     return $settings;
 }
开发者ID:AnimalsCode,项目名称:WooCommerce-Skip-One,代码行数:7,代码来源:class-wcso-admin-settings.php

示例4: entry_ease_divide_output_fields

function entry_ease_divide_output_fields()
{
    $post_types = wp_list_filter(get_post_types(array('public' => true)), array('attachment'), 'NOT');
    add_settings_section('general', __('General', 'entry_ease_divide_output'), '', 'entry_ease_divide_output');
    add_settings_field('entry_ease_divide_output_post_types', __('Active post types', 'entry_ease_divide_output'), 'entry_ease_divide_output_post_type_checkbox', 'entry_ease_divide_output', 'general', array('name' => 'eedo_post_types[]', 'value' => get_option('eedo_post_types'), 'option' => $post_types));
    add_settings_section('before', __('Default for before', 'entry_ease_divide_output'), '', 'entry_ease_divide_output');
    add_settings_field('entry_ease_divide_output_before_default_text', __('Before Text', 'entry_ease_divide_output'), 'entry_ease_divide_output_textarea_field', 'entry_ease_divide_output', 'before', array('name' => 'eedo_before_default_text', 'value' => get_option('eedo_before_default_text')));
    add_settings_section('after', __('Default for after', 'entry_ease_divide_output'), '', 'entry_ease_divide_output');
    add_settings_field('entry_ease_divide_output_after_default_text', __('After Text', 'entry_ease_divide_output'), 'entry_ease_divide_output_textarea_field', 'entry_ease_divide_output', 'after', array('name' => 'eedo_after_default_text', 'value' => get_option('eedo_after_default_text')));
}
开发者ID:Webnist,项目名称:entry-ease-divide-output,代码行数:10,代码来源:entry_ease_divide_output.php

示例5: wp_filter_object_list

function wp_filter_object_list($list, $args = array(), $operator = 'and', $field = false)
{
    if (!is_array($list)) {
        return array();
    }
    $list = wp_list_filter($list, $args, $operator);
    if ($field) {
        $list = wp_list_pluck($list, $field);
    }
    return $list;
}
开发者ID:jonsource,项目名称:zf2wp,代码行数:11,代码来源:my.php

示例6: get_categories

 public static function get_categories()
 {
     global $wp_query;
     $defaults = array('before' => '', 'after' => '', 'force_display' => false);
     $args = array();
     $args = wp_parse_args($args, $defaults);
     extract($args);
     $term = get_queried_object();
     $parent_id = empty($term->term_id) ? 0 : $term->term_id;
     if (is_product_category()) {
         $display_type = get_woocommerce_term_meta($term->term_id, 'display_type', true);
         switch ($display_type) {
             case 'products':
                 return;
                 break;
             case '':
                 if (get_option('woocommerce_category_archive_display') == '') {
                     return;
                 }
                 break;
         }
     }
     $product_categories = get_categories(apply_filters('woocommerce_product_subcategories_args', array('parent' => $parent_id, 'menu_order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1, 'taxonomy' => 'product_cat', 'pad_counts' => 1)));
     if (!apply_filters('woocommerce_product_subcategories_hide_empty', false)) {
         $product_categories = wp_list_filter($product_categories, array('count' => 0), 'NOT');
     }
     if ($product_categories) {
         echo $before;
         foreach ($product_categories as $category) {
             wc_get_template('content-product_cat.php', array('category' => $category));
         }
         if (is_product_category()) {
             $display_type = get_woocommerce_term_meta($term->term_id, 'display_type', true);
             switch ($display_type) {
                 case 'subcategories':
                     $wp_query->post_count = 0;
                     $wp_query->max_num_pages = 0;
                     break;
                 case '':
                     if (get_option('woocommerce_category_archive_display') == 'subcategories') {
                         $wp_query->post_count = 0;
                         $wp_query->max_num_pages = 0;
                     }
                     break;
             }
         }
         if (is_shop() && get_option('woocommerce_shop_page_display') == 'subcategories') {
             $wp_query->post_count = 0;
             $wp_query->max_num_pages = 0;
         }
         echo $after;
         return true;
     }
 }
开发者ID:hikaram,项目名称:wee,代码行数:54,代码来源:pf-shortcode.php

示例7: walk

 function walk($elements, $args = array())
 {
     $output = '';
     $args = wp_parse_args($args, array('value' => 'slug', 'name' => 'lang_choice'));
     if (!empty($args['flag'])) {
         $current = wp_list_filter($elements, array($args['value'] => $args['selected']));
         $lang = reset($current);
         $output = sprintf('<span class="pll-select-flag">%s</span>', empty($lang->flag) ? esc_html($lang->slug) : $lang->flag);
     }
     $output .= sprintf('<select name="%1$s" %2$s%3$s%4$s>' . "\n" . '%5$s' . "\n" . '</select>' . "\n", $name = esc_attr($args['name']), isset($args['id']) && !$args['id'] ? '' : ' id="' . (empty($args['id']) ? $name : esc_attr($args['id'])) . '"', empty($args['class']) ? '' : ' class="' . esc_attr($args['class']) . '"', empty($args['disabled']) ? '' : ' disabled="disabled"', parent::walk($elements, -1, $args));
     return $output;
 }
开发者ID:WordPressArt,项目名称:conisia,代码行数:12,代码来源:walker-dropdown.php

示例8: categoryitems_short

        public function categoryitems_short($atts)
        {
            global $woocommerce_loop, $woocommerce;
            extract(shortcode_atts(array('number' => 4, 'orderby' => 'name', 'order' => 'ASC', 'columns' => '4', 'hide_empty' => 1, 'parent' => '', 'itemselection' => 'featured', 'limit' => 4, 'mode' => ''), $atts));
            if (isset($atts['ids'])) {
                $ids = explode(',', $atts['ids']);
                $ids = array_map('trim', $ids);
            } else {
                $ids = array();
            }
            $hide_empty = $hide_empty == true || $hide_empty == 1 ? 1 : 0;
            // get terms and workaround WP bug with parents/pad counts
            $cat_args = array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $parent);
            $product_categories = get_terms('product_cat', $cat_args);
            if ($parent !== "") {
                $product_categories = wp_list_filter($product_categories, array('parent' => $parent));
            }
            if ($number) {
                $product_categories = array_slice($product_categories, 0, $number);
            }
            $woocommerce_loop['columns'] = $columns;
            $this->print_scripts_styles();
            ob_start();
            $html = '<nav>';
            if ($product_categories) {
                echo '<div class="main">
							<div ' . ($mode == 'slider' ? ' ' : ' id="mi-slider" class="mi-slider" ') . ' >';
                if ($mode == 'slider') {
                    echo '<ul data-slider="ios" class="ios-products">';
                }
                foreach ($product_categories as $category) {
                    $html .= '<a href="#">' . $category->name . '</a>';
                    if ($mode != 'slider') {
                        echo '<ul>';
                    }
                    $this->products($category->slug, $itemselection, array('per_page' => $limit, 'mode' => $mode, 'cat_name' => $category->name));
                    if ($mode != 'slider') {
                        echo '</ul>';
                    }
                }
                $html .= '</nav>';
                if ($mode != 'slider') {
                    echo $html;
                }
                if ($mode == 'slider') {
                    echo '</ul>';
                }
                echo '	
						</div>
					</div>';
            }
            return '<div class="woocommerce">' . ob_get_clean() . '</div>';
        }
开发者ID:binq2,项目名称:borealpaddle,代码行数:53,代码来源:category_items.php

示例9: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('per_page' => '', 'orderby' => 'name', 'order' => 'ASC', 'ids' => '', 'categories_style' => 'normal', 'hide_empty' => 'true', 'parent' => '', 'autoheight' => true, 'autoplay' => false, 'mousedrag' => true, 'autoplayspeed' => 5000, 'slidespeed' => 200, 'carousel_skin' => '', 'desktop' => 4, 'desktopsmall' => 3, 'tablet' => 2, 'mobile' => 1, 'gutters' => false, 'navigation' => true, 'navigation_always_on' => true, 'navigation_position' => 'center-outside', 'navigation_style' => 'normal', 'pagination' => false, 'pagination_position' => 'center-bottom', 'pagination_style' => 'dot-stroke', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
     if ($atts['categories_style'] == 'modern') {
         $atts['gutters'] = true;
     }
     $atts['columns'] = $atts['desktop'];
     $atts['number'] = $atts['per_page'];
     $atts['hide_empty'] = apply_filters('sanitize_boolean', $atts['hide_empty']);
     extract($atts);
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'products-categories-carousel ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'woocommerce' => 'woocommerce columns-' . $desktop, 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'style' => 'style-' . $categories_style);
     $carousel_ouput = cruxstore_render_carousel(apply_filters('cruxstore_render_args', $atts), '', 'cruxstore-owl-carousel');
     $output = $carousel_html = '';
     if (isset($atts['ids'])) {
         $ids = explode(',', $atts['ids']);
         $ids = array_map('trim', $ids);
     } else {
         $ids = array();
     }
     $hide_empty = $atts['hide_empty'] == true || $atts['hide_empty'] == 1 ? 1 : 0;
     // get terms and workaround WP bug with parents/pad counts
     $args = array('orderby' => $atts['orderby'], 'order' => $atts['order'], 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $atts['parent']);
     $product_categories = get_terms('product_cat', $args);
     if ('' !== $atts['parent']) {
         $product_categories = wp_list_filter($product_categories, array('parent' => $atts['parent']));
     }
     if ($hide_empty) {
         foreach ($product_categories as $key => $category) {
             if ($category->count == 0) {
                 unset($product_categories[$key]);
             }
         }
     }
     if ($atts['number']) {
         $product_categories = array_slice($product_categories, 0, $atts['number']);
     }
     ob_start();
     if ($product_categories) {
         global $woocommerce_carousel;
         $woocommerce_carousel = $categories_style;
         foreach ($product_categories as $category) {
             wc_get_template('content-product_cat_carousel.php', array('category' => $category));
         }
     }
     wp_reset_postdata();
     $carousel_html .= ob_get_clean();
     if ($carousel_html) {
         $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
         $output = '<div class="' . esc_attr($elementClass) . '">' . str_replace('%carousel_html%', $carousel_html, $carousel_ouput) . '</div>';
     }
     return $output;
 }
开发者ID:websideas,项目名称:Mondova,代码行数:52,代码来源:product_categories_carousel.php

示例10: remove_link

 /**
  * Removes a link from the response.
  *
  * @since 4.4.0
  * @access public
  *
  * @param  string $rel  Link relation. Either an IANA registered type, or an absolute URL.
  * @param  string $href Optional. Only remove links for the relation matching the given href.
  *                      Default null.
  */
 public function remove_link($rel, $href = null)
 {
     if (!isset($this->links[$rel])) {
         return;
     }
     if ($href) {
         $this->links[$rel] = wp_list_filter($this->links[$rel], array('href' => $href), 'NOT');
     } else {
         $this->links[$rel] = array();
     }
     if (!$this->links[$rel]) {
         unset($this->links[$rel]);
     }
 }
开发者ID:BoldGrid,项目名称:WordPress,代码行数:24,代码来源:class-wp-rest-response.php

示例11: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('per_page' => '', 'orderby' => 'name', 'order' => 'ASC', 'ids' => '', 'hide_empty' => 'true', 'columns' => '4', 'parent' => '', 'css_animation' => '', 'animation_delay' => '', 'el_class' => '', 'css' => ''), $atts);
     $atts['number'] = $atts['per_page'];
     $atts['hide_empty'] = apply_filters('sanitize_boolean', $atts['hide_empty']);
     extract($atts);
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'products-categories-grid ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => cruxstore_getCSSAnimation($css_animation), 'woocommerce' => 'woocommerce columns-' . $columns, 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
     if (isset($atts['ids'])) {
         $ids = explode(',', $atts['ids']);
         $ids = array_map('trim', $ids);
     } else {
         $ids = array();
     }
     $hide_empty = $atts['hide_empty'] == true || $atts['hide_empty'] == 1 ? 1 : 0;
     // get terms and workaround WP bug with parents/pad counts
     $args = array('orderby' => $atts['orderby'], 'order' => $atts['order'], 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $atts['parent']);
     $product_categories = get_terms('product_cat', $args);
     if ('' !== $atts['parent']) {
         $product_categories = wp_list_filter($product_categories, array('parent' => $atts['parent']));
     }
     if ($hide_empty) {
         foreach ($product_categories as $key => $category) {
             if ($category->count == 0) {
                 unset($product_categories[$key]);
             }
         }
     }
     if ($atts['number']) {
         $product_categories = array_slice($product_categories, 0, $atts['number']);
     }
     ob_start();
     if ($product_categories) {
         echo '<div class="row multi-columns-row">';
         $bootstrapColumn = round(12 / $columns);
         foreach ($product_categories as $category) {
             echo '<div class="col-md-' . $bootstrapColumn . ' col-sm-' . $bootstrapColumn . '">';
             wc_get_template('content-product_cat_grid.php', array('category' => $category));
             echo '</div>';
         }
         echo '</div>';
     }
     wp_reset_postdata();
     $output = ob_get_clean();
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     if ($animation_delay) {
         $animation_delay = sprintf(' data-wow-delay="%sms"', $animation_delay);
     }
     return '<div class="' . esc_attr($elementClass) . '"' . $animation_delay . '>' . $output . '</div>';
 }
开发者ID:websideas,项目名称:Mondova,代码行数:49,代码来源:product_categories_grid.php

示例12: content

 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('title' => esc_html__('Title', 'js_composer'), 'per_page' => '', 'orderby' => 'name', 'order' => 'ASC', 'ids' => '', 'categories_style' => 'normal', 'hide_empty' => 'true', 'parent' => '', 'css_animation' => '', 'animation_delay' => '', 'el_class' => '', 'css' => ''), $atts);
     $atts['hide_empty'] = apply_filters('sanitize_boolean', $atts['hide_empty']);
     $atts['number'] = $atts['per_page'];
     extract($atts);
     $output = '';
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'products-categories-list ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => cruxstore_getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'style' => 'style-' . $categories_style);
     if (isset($atts['ids'])) {
         $ids = explode(',', $atts['ids']);
         $ids = array_map('trim', $ids);
     } else {
         $ids = array();
     }
     $hide_empty = $atts['hide_empty'] == true || $atts['hide_empty'] == 1 ? 1 : 0;
     // get terms and workaround WP bug with parents/pad counts
     $args = array('orderby' => $atts['orderby'], 'order' => $atts['order'], 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $atts['parent']);
     $product_categories = get_terms('product_cat', $args);
     if ('' !== $atts['parent']) {
         $product_categories = wp_list_filter($product_categories, array('parent' => $atts['parent']));
     }
     if ($hide_empty) {
         foreach ($product_categories as $key => $category) {
             if ($category->count == 0) {
                 unset($product_categories[$key]);
             }
         }
     }
     if ($atts['number']) {
         $product_categories = array_slice($product_categories, 0, $atts['number']);
     }
     $output .= sprintf('<h4 class="%s">%s</h4>', 'products-categories-heading', $title);
     if ($product_categories) {
         $output .= '<ul>';
         foreach ($product_categories as $category) {
             $output .= sprintf('<li><a href="%s">%s</a></li>', get_term_link($category->slug, 'product_cat'), $category->name);
         }
         $output .= '</ul>';
     }
     if ($animation_delay) {
         $animation_delay = sprintf(' data-wow-delay="%sms"', $animation_delay);
     }
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div class="' . esc_attr($elementClass) . '"' . $animation_delay . '>' . $output . '</div>';
 }
开发者ID:websideas,项目名称:Mondova,代码行数:45,代码来源:product_categories_list.php

示例13: wb_products

function wb_products($atts, $before, $after)
{
    global $woocommerce_loop;
    $atts = shortcode_atts(array('number' => null, 'orderby' => 'name', 'order' => 'ASC', 'columns' => '4', 'hide_empty' => 1, 'parent' => '', 'ids' => ''), $atts);
    if (isset($atts['ids'])) {
        $ids = explode(',', $atts['ids']);
        $ids = array_map('trim', $ids);
    } else {
        $ids = array();
    }
    $hide_empty = $atts['hide_empty'] == true || $atts['hide_empty'] == 1 ? 1 : 0;
    // get terms and workaround WP bug with parents/pad counts
    $args = array('orderby' => $atts['orderby'], 'order' => $atts['order'], 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $atts['parent']);
    $product_categories = get_terms('product_cat', $args);
    if ('' !== $atts['parent']) {
        $product_categories = wp_list_filter($product_categories, array('parent' => $atts['parent']));
    }
    if ($hide_empty) {
        foreach ($product_categories as $key => $category) {
            if ($category->count == 0) {
                unset($product_categories[$key]);
            }
        }
    }
    if ($atts['number']) {
        $product_categories = array_slice($product_categories, 0, $atts['number']);
    }
    $columns = absint($atts['columns']);
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    // Reset loop/columns globals when starting a new loop
    $woocommerce_loop['loop'] = $woocommerce_loop['column'] = '';
    if ($product_categories) {
        echo $before;
        foreach ($product_categories as $category) {
            wc_get_template('content-product_cat.php', array('category' => $category));
        }
        echo $after;
    }
    woocommerce_reset_loop();
    return ob_get_clean();
}
开发者ID:Web-Ares,项目名称:shop-shablon,代码行数:42,代码来源:wc-functions.php

示例14: generate_completion

 public function generate_completion($post)
 {
     /**
      * Used for exclude functions
      *
      * @param array  list to exclude
      * @param string current function name
      */
     $exclude_functions = apply_filters('sublime_export_exclude_functions', array(), $post->post_title);
     $exclude_functions = is_array($exclude_functions) ? $exclude_functions : array();
     if (in_array($post->post_title, $exclude_functions)) {
         return false;
     }
     /**
      * Used for exclude private functions
      *
      * @param bool   true or false for exclude
      * @param object post
      *
      */
     if (apply_filters('sublime_export_exclude_private_functions', false, $post)) {
         return false;
     }
     $arguments = $this->get_arguments($post->ID);
     $return = wp_list_filter(get_post_meta($post->ID, '_wp-parser_tags', true), array('name' => 'return'));
     /**
      * Used for change defaults arguments
      *
      * @param array  $arguments
      * @param string $name
      *
      * @return array $arguments
      */
     $arguments = apply_filters('sublime_export_default_arguments', $arguments, $post->post_title);
     if ($last = array_pop($arguments)) {
         if (!$this->is_deprecated($last)) {
             $arguments[] = $last;
         }
     }
     return array('trigger' => "{$post->post_title}\tWP Function", 'contents' => $this->contents($post->post_title, $this->parse_arguments($arguments), !empty($return)));
 }
开发者ID:23r9i0,项目名称:sublime,代码行数:41,代码来源:class-functions.php

示例15: show_field

 public static function show_field($field, $fields)
 {
     $result = null;
     if (isset($field['conditional_logic']) && !empty($field['conditional_logic'])) {
         foreach ($field['conditional_logic'] as $logic_group) {
             $group_result = true;
             foreach ($logic_group as $rule) {
                 $other_field = wp_list_filter($fields, array('key' => $rule['field']));
                 $other_value = null;
                 if ($other_field) {
                     $other_field = array_shift($other_field);
                     $other_value = isset($other_field['value']) ? $other_field['value'] : null;
                 }
                 switch ($rule['operator']) {
                     case '==':
                         if (is_array($other_value)) {
                             $group_result &= in_array($other_value, $rule['value']);
                         } else {
                             $group_result &= $other_value == $rule['value'];
                         }
                         break;
                     case '!=':
                         if (is_array($other_value)) {
                             $group_result &= !in_array($other_value, $rule['value']);
                         } else {
                             $group_result &= $other_value != $rule['value'];
                         }
                         break;
                     default:
                         break;
                 }
             }
             if ($result == null) {
                 $result = $group_result;
             } else {
                 $result |= $group_result;
             }
         }
     }
     return $result !== null ? $result : true;
 }
开发者ID:NikolaGrdanjski,项目名称:acf-views,代码行数:41,代码来源:acf-views-conditional-logic.php


注:本文中的wp_list_filter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。