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


PHP wp_list_pluck函数代码示例

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


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

示例1: get_comments

 /**
  * Get comments
  *
  * @since 0.0.1
  *
  * @param array $data Sanitized data from request
  *
  * @return array
  */
 public static function get_comments($data)
 {
     $args = api_helper::get_comment_args($data['postID']);
     $options = options::get_display_options();
     $comments = get_comments($args);
     if ('ASC' == $options['order']) {
         $parents = array_combine(wp_list_pluck($comments, 'comment_ID'), wp_list_pluck($comments, 'comment_parent'));
         asort($parents);
         $comments = (array) $comments;
         $comments = array_combine(wp_list_pluck($comments, 'comment_ID'), $comments);
         $i = 0;
         foreach ($comments as $id => $parent) {
             $_comments[$i] = $comments[$id];
             $i++;
         }
         rsort($_comments);
         $comments = $_comments;
     }
     if (!empty($comments) && is_array($comments)) {
         $comments = api_helper::improve_comment_response($comments, !api_helper::thread());
         $comments = wp_json_encode($comments);
     } else {
         return false;
     }
     return array('comments' => $comments);
 }
开发者ID:rpkoller,项目名称:epoch,代码行数:35,代码来源:api_process.php

示例2: test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit

 /**
  * @ticket 26948
  */
 public function test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit()
 {
     register_taxonomy('wptests_tax_1', 'post', array('show_in_quick_edit' => false, 'hierarchical' => true));
     register_taxonomy('wptests_tax_2', 'post', array('show_in_quick_edit' => true, 'hierarchical' => true));
     $t1 = self::factory()->term->create(array('taxonomy' => 'wptests_tax_1'));
     $t2 = self::factory()->term->create(array('taxonomy' => 'wptests_tax_2'));
     // Become an administrator.
     $this->_setRole('administrator');
     $post = self::factory()->post->create_and_get(array('post_author' => get_current_user_id()));
     // Set up a request.
     $_POST['_inline_edit'] = wp_create_nonce('inlineeditnonce');
     $_POST['post_ID'] = $post->ID;
     $_POST['post_type'] = $post->post_type;
     $_POST['content'] = $post->post_content;
     $_POST['excerpt'] = $post->post_excerpt;
     $_POST['_status'] = $post->post_status;
     $_POST['post_status'] = $post->post_status;
     $_POST['screen'] = 'post';
     $_POST['post_view'] = 'excerpt';
     $_POST['tax_input'] = array('wptests_tax_1' => array($t1), 'wptests_tax_2' => array($t2));
     // Make the request.
     try {
         $this->_handleAjax('inline-save');
     } catch (WPAjaxDieContinueException $e) {
         unset($e);
     }
     // wptests_tax_1 terms should have been refused.
     $post_terms_1 = wp_get_object_terms($post->ID, 'wptests_tax_1');
     $this->assertEmpty($post_terms_1);
     // wptests_tax_2 terms should have been added successfully.
     $post_terms_2 = wp_get_object_terms($post->ID, 'wptests_tax_2');
     $this->assertEqualSets(array($t2), wp_list_pluck($post_terms_2, 'term_id'));
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:36,代码来源:QuickEdit.php

示例3: query_report_data

 /**
  * Get all data needed for this report and store in the class
  */
 private function query_report_data()
 {
     $this->report_data = new stdClass();
     $this->report_data->orders = (array) $this->get_order_report_data(array('data' => array('_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales'), '_order_shipping' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_shipping'), '_order_tax' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_tax'), '_order_shipping_tax' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_shipping_tax'), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date')), 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => array_merge(array('shop_order_refund'), wc_get_order_types('sales-reports')), 'order_status' => array('completed', 'processing', 'on-hold'), 'parent_order_status' => array('completed', 'processing', 'on-hold')));
     $this->report_data->order_counts = (array) $this->get_order_report_data(array('data' => array('ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'count', 'distinct' => true), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date')), 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('completed', 'processing', 'on-hold')));
     $this->report_data->coupons = (array) $this->get_order_report_data(array('data' => array('order_item_name' => array('type' => 'order_item', 'function' => '', 'name' => 'order_item_name'), 'discount_amount' => array('type' => 'order_item_meta', 'order_item_type' => 'coupon', 'function' => 'SUM', 'name' => 'discount_amount'), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date')), 'where' => array(array('key' => 'order_items.order_item_type', 'value' => 'coupon', 'operator' => '=')), 'group_by' => $this->group_by_query . ', order_item_name', 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('completed', 'processing', 'on-hold')));
     $this->report_data->order_items = (array) $this->get_order_report_data(array('data' => array('_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_count'), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date')), 'where' => array(array('key' => 'order_items.order_item_type', 'value' => 'line_item', 'operator' => '=')), 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('completed', 'processing', 'on-hold')));
     $this->report_data->refunded_order_items = (array) $this->get_order_report_data(array('data' => array('_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_count'), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date')), 'where' => array(array('key' => 'order_items.order_item_type', 'value' => 'line_item', 'operator' => '=')), 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('refunded')));
     $this->report_data->partial_refunds = (array) $this->get_order_report_data(array('data' => array('_refund_amount' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_refund'), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date'), '_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_count')), 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_status' => false, 'parent_order_status' => array('completed', 'processing', 'on-hold')));
     foreach ($this->report_data->partial_refunds as $key => $value) {
         $this->report_data->partial_refunds[$key]->order_item_count = $this->report_data->partial_refunds[$key]->order_item_count * -1;
     }
     $this->report_data->order_items = array_merge($this->report_data->order_items, $this->report_data->partial_refunds);
     $this->report_data->total_order_refunds = array_sum((array) absint($this->get_order_report_data(array('data' => array('ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_var', 'filter_range' => true, 'order_types' => wc_get_order_types('order-count'), 'order_status' => array('refunded')))));
     $this->report_data->full_refunds = (array) $this->get_order_report_data(array('data' => array('_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_refund'), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date')), 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_status' => array('refunded')));
     $this->report_data->refunds = array_merge($this->report_data->partial_refunds, $this->report_data->full_refunds);
     $this->report_data->total_sales = wc_format_decimal(array_sum(wp_list_pluck($this->report_data->orders, 'total_sales')), 2);
     $this->report_data->total_tax = wc_format_decimal(array_sum(wp_list_pluck($this->report_data->orders, 'total_tax')), 2);
     $this->report_data->total_shipping = wc_format_decimal(array_sum(wp_list_pluck($this->report_data->orders, 'total_shipping')), 2);
     $this->report_data->total_shipping_tax = wc_format_decimal(array_sum(wp_list_pluck($this->report_data->orders, 'total_shipping_tax')), 2);
     $this->report_data->total_refunds = wc_format_decimal(array_sum(wp_list_pluck($this->report_data->partial_refunds, 'total_refund')) + array_sum(wp_list_pluck($this->report_data->full_refunds, 'total_refund')), 2);
     $this->report_data->total_coupons = number_format(array_sum(wp_list_pluck($this->report_data->coupons, 'discount_amount')), 2);
     $this->report_data->total_orders = absint(array_sum(wp_list_pluck($this->report_data->order_counts, 'count')));
     $this->report_data->total_partial_refunds = array_sum(wp_list_pluck($this->report_data->partial_refunds, 'order_item_count')) * -1;
     $this->report_data->total_item_refunds = array_sum(wp_list_pluck($this->report_data->refunded_order_items, 'order_item_count')) * -1;
     $this->report_data->total_items = absint(array_sum(wp_list_pluck($this->report_data->order_items, 'order_item_count')) * -1);
     $this->report_data->average_sales = wc_format_decimal($this->report_data->total_sales / ($this->chart_interval + 1), 2);
     $this->report_data->net_sales = wc_format_decimal($this->report_data->total_sales - $this->report_data->total_shipping - $this->report_data->total_tax - $this->report_data->total_shipping_tax, 2);
 }
开发者ID:amusiiko,项目名称:armo,代码行数:32,代码来源:class-wc-report-sales-by-date.php

示例4: bulky_woocommerce_cart_shipping_packages

 public static function bulky_woocommerce_cart_shipping_packages($packages)
 {
     // Reset the packages
     $packages = array();
     // Bulky items
     $free_items = array();
     $regular_items = array();
     // Sort free from others
     foreach (WC()->cart->get_cart() as $item) {
         if ($item['data']->needs_shipping()) {
             if ($item['data']->get_shipping_class() == 'free' || $item['data']->get_shipping_class() == '') {
                 $free_items[] = $item;
             } else {
                 $regular_items[] = $item;
             }
         }
     }
     // Put inside packages
     if ($free_items) {
         $packages[] = array('ship_via' => array('free_shipping'), 'contents' => $free_items, 'contents_cost' => array_sum(wp_list_pluck($free_items, 'line_total')), 'applied_coupons' => WC()->cart->applied_coupons, 'destination' => array('country' => WC()->customer->get_shipping_country(), 'state' => WC()->customer->get_shipping_state(), 'postcode' => WC()->customer->get_shipping_postcode(), 'city' => WC()->customer->get_shipping_city(), 'address' => WC()->customer->get_shipping_address(), 'address_2' => WC()->customer->get_shipping_address_2()));
     }
     if ($regular_items) {
         $packages[] = array('ship_via' => array('flat_rate'), 'contents' => $regular_items, 'contents_cost' => array_sum(wp_list_pluck($regular_items, 'line_total')), 'applied_coupons' => WC()->cart->applied_coupons, 'destination' => array('country' => WC()->customer->get_shipping_country(), 'state' => WC()->customer->get_shipping_state(), 'postcode' => WC()->customer->get_shipping_postcode(), 'city' => WC()->customer->get_shipping_city(), 'address' => WC()->customer->get_shipping_address(), 'address_2' => WC()->customer->get_shipping_address_2()));
     }
     return $packages;
 }
开发者ID:essenmitsosse,项目名称:woocommerce-bulk-shipping-seperated,代码行数:26,代码来源:woocommerce-bulk-shipping-seperated.php

示例5: list_

 /**
  * List terms in a taxonomy.
  *
  * ## OPTIONS
  *
  * <taxonomy>...
  * : List terms of one or more taxonomies
  *
  * [--<field>=<value>]
  * : Filter by one or more fields (see get_terms() $args parameter for a list of fields).
  *
  * [--field=<field>]
  * : Prints the value of a single field for each term.
  *
  * [--fields=<fields>]
  * : Limit the output to specific object fields.
  *
  * [--format=<format>]
  * : Accepted values: table, csv, json, count, yaml. Default: table
  *
  * ## AVAILABLE FIELDS
  *
  * These fields will be displayed by default for each term:
  *
  * * term_id
  * * term_taxonomy_id
  * * name
  * * slug
  * * description
  * * parent
  * * count
  *
  * There are no optionally available fields.
  *
  * ## EXAMPLES
  *
  *     wp term list category --format=csv
  *
  *     wp term list post_tag --fields=name,slug
  *
  * @subcommand list
  */
 public function list_($args, $assoc_args)
 {
     foreach ($args as $taxonomy) {
         if (!taxonomy_exists($taxonomy)) {
             WP_CLI::error("Taxonomy {$taxonomy} doesn't exist.");
         }
     }
     $formatter = $this->get_formatter($assoc_args);
     $defaults = array('hide_empty' => false);
     $assoc_args = array_merge($defaults, $assoc_args);
     if (!empty($assoc_args['term_id'])) {
         $term = get_term_by('id', $assoc_args['term_id'], $args[0]);
         $terms = array($term);
     } else {
         $terms = get_terms($args, $assoc_args);
     }
     $terms = array_map(function ($term) {
         $term->count = (int) $term->count;
         $term->parent = (int) $term->parent;
         return $term;
     }, $terms);
     if ('ids' == $formatter->format) {
         $terms = wp_list_pluck($terms, 'term_id');
         echo implode(' ', $terms);
     } else {
         $formatter->display_items($terms);
     }
 }
开发者ID:ryanshoover,项目名称:wp-cli,代码行数:70,代码来源:term.php

示例6: get_pages

 public function get_pages($pages, $args)
 {
     $language = empty($args['lang']) ? $this->curlang : $this->model->get_language($args['lang']);
     if (empty($language) || empty($pages) || !$this->model->is_translated_post_type($args['post_type'])) {
         return $pages;
     }
     static $once = false;
     // obliged to redo the get_pages query if we want to get the right number
     if (!empty($args['number']) && !$once) {
         $once = true;
         // avoid infinite loop
         $r = array('lang' => 0, 'numberposts' => -1, 'nopaging' => true, 'post_type' => $args['post_type'], 'fields' => 'ids', 'tax_query' => array(array('taxonomy' => 'language', 'field' => 'term_taxonomy_id', 'terms' => $language->term_taxonomy_id, 'operator' => 'NOT IN')));
         $args['exclude'] = array_merge($args['exclude'], get_posts($r));
         $pages = get_pages($args);
     }
     $ids = wp_list_pluck($pages, 'ID');
     // filters the queried list of pages by language
     if (!$once) {
         $ids = array_intersect($ids, $this->model->get_objects_in_language($language));
         foreach ($pages as $key => $page) {
             if (!in_array($page->ID, $ids)) {
                 unset($pages[$key]);
             }
         }
     }
     // not done by WP but extremely useful for performance when manipulating taxonomies
     update_object_term_cache($ids, $args['post_type']);
     $once = false;
     // in case get_pages is called another time
     return $pages;
 }
开发者ID:kivivuori,项目名称:jotain,代码行数:31,代码来源:filters.php

示例7: wc_get_product_terms

/**
 * Wrapper for wp_get_post_terms which supports ordering by parent.
 *
 * NOTE: At this point in time, ordering by menu_order for example isn't possible with this function. wp_get_post_terms has no
 *   filters which we can utilise to modify it's query. https://core.trac.wordpress.org/ticket/19094
 * 
 * @param  int $product_id
 * @param  string $taxonomy
 * @param  array  $args
 * @return array
 */
function wc_get_product_terms($product_id, $taxonomy, $args = array())
{
    if (!taxonomy_exists($taxonomy)) {
        return array();
    }
    if (empty($args['orderby']) && taxonomy_is_product_attribute($taxonomy)) {
        $args['orderby'] = wc_attribute_orderby($taxonomy);
    }
    // Support ordering by parent
    if (!empty($args['orderby']) && $args['orderby'] == 'parent') {
        $fields = isset($args['fields']) ? $args['fields'] : 'all';
        // Unset for wp_get_post_terms
        unset($args['orderby']);
        unset($args['fields']);
        $terms = wp_get_post_terms($product_id, $taxonomy, $args);
        usort($terms, '_wc_get_product_terms_parent_usort_callback');
        switch ($fields) {
            case 'names':
                $terms = wp_list_pluck($terms, 'name');
                break;
            case 'ids':
                $terms = wp_list_pluck($terms, 'term_id');
                break;
            case 'slugs':
                $terms = wp_list_pluck($terms, 'slug');
                break;
        }
    } else {
        $terms = wp_get_post_terms($product_id, $taxonomy, $args);
    }
    return $terms;
}
开发者ID:Joaquinsemp,项目名称:patriestausado,代码行数:43,代码来源:wc-term-functions.php

示例8: test_last_activity_should_bust_activity_with_last_activity_cache

 /**
  * @ticket BP7237
  * @ticket BP6643
  * @ticket BP7245
  */
 public function test_last_activity_should_bust_activity_with_last_activity_cache()
 {
     global $wpdb;
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $time_1 = date('Y-m-d H:i:s', time() - HOUR_IN_SECONDS);
     $time_2 = date('Y-m-d H:i:s', time() - HOUR_IN_SECONDS * 2);
     bp_update_user_last_activity($u1, $time_1);
     bp_update_user_last_activity($u2, $time_2);
     $activity_args_a = array('filter' => array('object' => buddypress()->members->id, 'action' => 'last_activity'), 'max' => 1);
     $activity_args_b = array('filter' => array('action' => 'new_member'), 'fields' => 'ids');
     // Prime bp_activity and bp_activity_with_last_activity caches.
     $a1 = bp_activity_get($activity_args_a);
     $expected = array($u1, $u2);
     $found = array_map('intval', wp_list_pluck($a1['activities'], 'user_id'));
     $this->assertSame($expected, $found);
     $b1 = bp_activity_get($activity_args_b);
     // Bump u2 activity so it should appear first.
     $new_time = date('Y-m-d H:i:s', time() - HOUR_IN_SECONDS);
     bp_update_user_last_activity($u2, $new_time);
     $a2 = bp_activity_get($activity_args_a);
     $expected = array($u2, $u1);
     $found = array_map('intval', wp_list_pluck($a2['activities'], 'user_id'));
     $this->assertSame($expected, $found);
     $num_queries = $wpdb->num_queries;
     // bp_activity cache should not have been touched.
     $b2 = bp_activity_get($activity_args_b);
     $this->assertEqualSets($b1, $b2);
     $this->assertSame($num_queries, $wpdb->num_queries);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:35,代码来源:cache.php

示例9: wp_user_alerts_get_notices

/**
 * Return array of notice alerts
 *
 * @since 0.1.0
 *
 * @return array
 */
function wp_user_alerts_get_notices()
{
    // Dismissed notices are excluded
    $dismissed = wp_list_pluck(wp_user_alerts_get_dismissed_notices(), 'ID');
    // Get alerts
    return wp_user_alerts_get_posts(array('numberposts' => 10, 'exclude' => $dismissed, 'meta_query' => wp_user_alerts_get_meta_query(array('user' => wp_user_alerts_get_meta_query_user(), 'role' => wp_user_alerts_get_meta_query_role(), 'method' => 'notice'))));
}
开发者ID:stuttter,项目名称:wp-user-alerts,代码行数:14,代码来源:notices.php

示例10: thatcamp_registrations_add_registration

/**
 * Adds a single registration entry. This is a motley function.
 *
 * @param string The status of the registration record.
 **/
function thatcamp_registrations_add_registration($status = 'pending')
{
    global $wpdb;
    $table = $wpdb->prefix . "thatcamp_registrations";
    $_POST = stripslashes_deep($_POST);
    // The user_id is set to the posted user ID, or null.
    $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : null;
    $applicant_info = array();
    $applicant_fields = wp_list_pluck(thatcamp_registrations_fields(), 'id');
    foreach ($applicant_fields as $field) {
        $applicant_info[$field] = isset($_POST[$field]) ? $_POST[$field] : null;
    }
    $date = isset($_POST['date']) ? $_POST['date'] : null;
    $applicationText = isset($_POST['application_text']) ? $_POST['application_text'] : null;
    // Lets serialize the applicant_info before putting it in the database.
    $applicant_info = maybe_serialize($applicant_info);
    $applicant_email = isset($_POST['user_email']) ? $_POST['user_email'] : null;
    // Check for an existing registration
    $user_exists = false;
    if (!is_null($user_id) && thatcamp_registrations_get_registration_by_user_id($user_id) || thatcamp_registrations_get_registration_by_applicant_email($applicant_email)) {
        $user_exists = true;
    }
    if ($user_exists) {
        return 'You have already submitted your registration.';
    } else {
        $reg_id = $wpdb->insert($table, array('applicant_info' => $applicant_info, 'applicant_email' => $applicant_email, 'application_text' => $applicationText, 'status' => $status, 'date' => $date, 'user_id' => $user_id));
        thatcamp_registrations_send_applicant_email($applicant_email);
        thatcamp_registrations_send_admin_notification($wpdb->insert_id);
    }
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:35,代码来源:thatcamp-registrations-functions.php

示例11: test_category__and_var

	function test_category__and_var() {
		$term_id = $this->factory->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
		$term_id2 = $this->factory->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) );
		$post_id = $this->factory->post->create();

		wp_set_post_categories( $post_id, $term_id );

		$posts = $this->q->query( array( 'category__and' => array( $term_id ) ) );

		$this->assertEmpty( $this->q->get( 'category__and' ) );
		$this->assertCount( 0, $this->q->get( 'category__and' ) );
		$this->assertNotEmpty( $this->q->get( 'category__in' ) );
		$this->assertCount( 1, $this->q->get( 'category__in' ) );

		$this->assertNotEmpty( $posts );
		$this->assertEquals( array( $post_id ), wp_list_pluck( $posts, 'ID' ) );

		$posts2 = $this->q->query( array( 'category__and' => array( $term_id, $term_id2 ) ) );
		$this->assertNotEmpty( $this->q->get( 'category__and' ) );
		$this->assertCount( 2, $this->q->get( 'category__and' ) );
		$this->assertEmpty( $this->q->get( 'category__in' ) );
		$this->assertCount( 0, $this->q->get( 'category__in' ) );

		$this->assertEmpty( $posts2 );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:25,代码来源:query.php

示例12: has_field_type

 /**
  * Check whether settings has particular field type
  *
  * @param string field type
  * @return bool
  */
 function has_field_type($type)
 {
     if (in_array($type, wp_list_pluck($this->settings['fields'], 'type'))) {
         return true;
     }
     return false;
 }
开发者ID:andyhqtran,项目名称:divi-100-submodule,代码行数:13,代码来源:class-divi-100-settings.php

示例13: license_menu

 /**
  * Add Plugin License Menu
  *
  * @since 1.5.6
  */
 function license_menu()
 {
     global $submenu;
     if (isset($submenu[$this->main_menu_slug]) && !in_array($this->license_page_slug, wp_list_pluck($submenu[$this->main_menu_slug], 2))) {
         add_submenu_page($this->main_menu_slug, __('Plugin License', 'feed-them-social'), __('Plugin License', 'feed-them-social'), 'manage_options', $this->license_page_slug, array($this, 'license_page'));
     }
 }
开发者ID:mattywebb,项目名称:cyclery-northside,代码行数:12,代码来源:namespaced_EDD_SL_Plugin_Licence_Manager.php

示例14: init

 function init()
 {
     //move away from kl_ prefix
     $opts = get_option('kl_addnewdefaultavatar', false);
     if ($opts) {
         update_option('add_new_default_avatar', $opts);
         delete_option('kl_addnewdefaultavatar');
     }
     $opts = get_option('add_new_default_avatar', false);
     //upgrade option, we can now save multiple avatar options
     if (isset($opts['name'])) {
         $opts = array($opts);
         update_option('add_new_default_avatar', $opts);
     }
     if (!$opts) {
         return;
     }
     //get current default opton
     $current = get_option('avatar_default');
     //get any custom created avatars
     $unavailable = wp_list_pluck($opts, 'url');
     //if the current wasn't created by this plugin, update the backup
     if (!in_array($current, $unavailable)) {
         update_option('pre_anda_avatar_default', $current);
     }
 }
开发者ID:stiyes,项目名称:ngionic,代码行数:26,代码来源:kl_addnewdefaultavatar.php

示例15: display_posts_filter

 protected function display_posts_filter($args = array())
 {
     $default_args = array('post_type' => 'post', 'taxonomy' => 'category', 'query' => null, 'select' => 'all', 'show_category_filter' => true);
     $args = wp_parse_args($args, $default_args);
     $filter_args = array();
     if ($args['show_category_filter']) {
         // categorizer args
         $filter_args = array('taxonomy' => $args['taxonomy'], 'post_type' => $args['post_type'], 'select' => $args['select']);
         if ('only' == $args['select'] && $args['query'] && $args['query']->posts && isset($args['query']->tax_query->queried_terms[$args['taxonomy']]['terms'])) {
             $filter_args['terms'] = array();
             $queried_terms = $args['query']->tax_query->queried_terms[$args['taxonomy']]['terms'];
             $posts_ids = wp_list_pluck($args['query']->posts, 'ID');
             $posts_terms = wp_get_object_terms($posts_ids, $args['taxonomy']);
             foreach ($posts_terms as $term) {
                 if (in_array($term->slug, $queried_terms)) {
                     $filter_args['terms'][] = intval($term->term_id);
                 }
             }
             $filter_args['terms'] = array_unique($filter_args['terms']);
         }
     }
     $filter_class = '';
     if (!$this->config->get('template.posts_filter.orderby.enabled') && !$this->config->get('template.posts_filter.order.enabled')) {
         $filter_class .= ' extras-off';
     }
     // display categorizer
     presscore_get_category_list(array('data' => dt_prepare_categorizer_data($filter_args), 'class' => 'filter iso-filter' . $filter_class));
 }
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:28,代码来源:class-shortcode-masonry-posts.php


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