• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_list_filter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: widget

 public function widget($args, $instance)
 {
     global $post;
     $instance = wp_parse_args($instance, $this->defaults);
     $title = apply_filters('widget_title', $instance['title']);
     extract($args);
     add_image_size('wpsc_product_widget_thumbnail', $instance['width'], $instance['height'], wpsc_get_option('crop_thumbnails'));
     $on_sale_products = get_posts(array('post_type' => 'wpsc-product', 'nopaging' => true, 'post_status' => array('publish', 'inherit'), 'meta_query' => array(array('key' => '_wpsc_special_price', 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC'))));
     // extract products with no parents
     $products = wp_list_filter($on_sale_products, array('post_parent' => 0));
     // get parent of variations
     $parent_ids = array_unique(wp_list_pluck($on_sale_products, 'post_parent'));
     $parents = array();
     if (!empty($parent_ids)) {
         $parents = get_posts(array('post_type' => 'wpsc-product', 'nopaging' => true, 'post_status' => 'publish', 'post__in' => $parent_ids, 'post__not_in' => wp_list_pluck($products, 'ID')));
     }
     $products = array_merge($products, $parents);
     if (!empty($instance['post_count'])) {
         $products = array_slice($products, 0, $instance['post_count']);
     }
     include WPSC_TE_V2_SNIPPETS_PATH . '/widgets/on-sale/widget.php';
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:22,代码来源:on-sale.php


示例17: get_queried_object

 /**
  * Retrieve queried object.
  *
  * If queried object is not set, then the queried object will be set from
  * the category, tag, taxonomy, posts page, single post, page, or author
  * query variable. After it is set up, it will be returned.
  *
  * @since 1.5.0
  * @access public
  *
  * @return object
  */
 public function get_queried_object()
 {
     if (isset($this->queried_object)) {
         return $this->queried_object;
     }
     $this->queried_object = null;
     $this->queried_object_id = null;
     if ($this->is_category || $this->is_tag || $this->is_tax) {
         if ($this->is_category) {
             if ($this->get('cat')) {
                 $term = get_term($this->get('cat'), 'category');
             } elseif ($this->get('category_name')) {
                 $term = get_term_by('slug', $this->get('category_name'), 'category');
             }
         } elseif ($this->is_tag) {
             if ($this->get('tag_id')) {
                 $term = get_term($this->get('tag_id'), 'post_tag');
             } elseif ($this->get('tag')) {
                 $term = get_term_by('slug', $this->get('tag'), 'post_tag');
             }
         } else {
             // For other tax queries, grab the first term from the first clause.
             $tax_query_in_and = wp_list_filter($this->tax_query->queried_terms, array('operator' => 'NOT IN'), 'NOT');
             if (!empty($tax_query_in_and)) {
                 $queried_taxonomies = array_keys($tax_query_in_and);
                 $matched_taxonomy = reset($queried_taxonomies);
                 $query = $tax_query_in_and[$matched_taxonomy];
                 if ($query['terms']) {
                     if ('term_id' == $query['field']) {
                         $term = get_term(reset($query['terms']), $matched_taxonomy);
                     } else {
                         $term = get_term_by($query['field'], reset($query['terms']), $matched_taxonomy);
                     }
                 }
             }
         }
         if (!empty($term) && !is_wp_error($term)) {
             $this->queried_object = $term;
             $this->queried_object_id = (int) $term->term_id;
             if ($this->is_category && 'category' === $this->queried_object->taxonomy) {
                 _make_cat_compat($this->queried_object);
             }
         }
     } elseif ($this->is_post_type_archive) {
         $post_type = $this->get('post_type');
         if (is_array($post_type)) {
             $post_type = reset($post_type);
         }
         $this->queried_object = get_post_type_object($post_type);
     } elseif ($this->is_posts_page) {
         $page_for_posts = get_option('page_for_posts');
         $this->queried_object = get_post($page_for_posts);
         $this->queried_object_id = (int) $this->queried_object->ID;
     } elseif ($this->is_singular && !empty($this->post)) {
         $this->queried_object = $this->post;
         $this->queried_object_id = (int) $this->post->ID;
     } elseif ($this->is_author) {
         $this->queried_object_id = (int) $this->get('author');
         $this->queried_object = get_userdata($this->queried_object_id);
     }
     return $this->queried_object;
 }
开发者ID:inpsyde,项目名称:wordpress-dev,代码行数:74,代码来源:class-wp-query.php


示例18: get_excluded_by_key

 /**
  * @param $column string name of the setting key (authors|roles|actions|ip_addresses|contexts|connectors)
  *
  * @return array
  */
 public static function get_excluded_by_key($column)
 {
     $option_name = 'authors' === $column || 'roles' === $column ? 'exclude_authors_and_roles' : 'exclude_' . $column;
     $excluded_values = isset(self::$options[$option_name]) ? self::$options[$option_name] : array();
     if (is_callable($excluded_values)) {
         $excluded_values = call_user_func($excluded_values);
     }
     $excluded_values = wp_list_filter($excluded_values, array('__placeholder__'), 'NOT');
     if ('exclude_authors_and_roles' === $option_name) {
         // Convert numeric strings to integers
         array_walk($excluded_values, function (&$value) {
             if (is_numeric($value)) {
                 $value = absint($value);
             }
         });
         $filter = 'roles' === $column ? 'is_string' : 'is_int';
         // Author roles are always strings and author ID's are always integers
         $excluded_values = array_values(array_filter($excluded_values, $filter));
         // Reset the array keys
     }
     return $excluded_values;
 }
开发者ID:xwp,项目名称:stream-legacy,代码行数:27,代码来源:settings.php


示例19: update_many

 protected function update_many($args, $assoc_args)
 {
     call_user_func($this->upgrade_refresh);
     if (!empty($assoc_args['format']) && in_array($assoc_args['format'], array('json', 'csv'))) {
         $logger = new \WP_CLI\Loggers\Quiet();
         \WP_CLI::set_logger($logger);
     }
     if (!\WP_CLI\Utils\get_flag_value($assoc_args, 'all') && empty($args)) {
         \WP_CLI::error("Please specify one or more {$this->item_type}s, or use --all.");
     }
     $items = $this->get_item_list();
     if (!\WP_CLI\Utils\get_flag_value($assoc_args, 'all')) {
         $items = $this->filter_item_list($items, $args);
     }
     $items_to_update = wp_list_filter($items, array('update' => true));
     if (\WP_CLI\Utils\get_flag_value($assoc_args, 'dry-run')) {
         if (empty($items_to_update)) {
             \WP_CLI::line("No {$this->item_type} updates available.");
             return;
         }
         if (!empty($assoc_args['format']) && in_array($assoc_args['format'], array('json', 'csv'))) {
             \WP_CLI\Utils\format_items($assoc_args['format'], $items_to_update, array('name', 'status', 'version', 'update_version'));
         } else {
             if (!empty($assoc_args['format']) && 'summary' === $assoc_args['format']) {
                 \WP_CLI::line("Available {$this->item_type} updates:");
                 foreach ($items_to_update as $item_to_update => $info) {
                     \WP_CLI::log("{$info['title']} update from version {$info['version']} to version {$info['update_version']}");
                 }
             } else {
                 \WP_CLI::line("Available {$this->item_type} updates:");
                 \WP_CLI\Utils\format_items('table', $items_to_update, array('name', 'status', 'version', 'update_version'));
             }
         }
         return;
     }
     $result = array();
     // Only attempt to update if there is something to update
     if (!empty($items_to_update)) {
         $cache_manager = \WP_CLI::get_http_cache_manager();
         foreach ($items_to_update as $item) {
             $cache_manager->whitelist_package($item['update_package'], $this->item_type, $item['name'], $item['update_version']);
         }
         $upgrader = $this->get_upgrader($assoc_args);
         $result = $upgrader->bulk_upgrade(wp_list_pluck($items_to_update, 'update_id'));
     }
     // Let the user know the results.
     $num_to_update = count($items_to_update);
     $num_updated = count(array_filter($result) 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_list_pages函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_list_comments函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap