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

PHP term_exists函数代码示例

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

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



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

示例1: hyyan_slider_query

/**
 * Build WP_Query object for the given slider
 * 
 * @see Hyyan_Slider_Shortcode::FILTER_SHORTCODE_QueryArgs
 * 
 * @param string $slider slider name
 * @param string $order slides order
 * @param string $orderBy order slides by ?
 * 
 * @return \WP_Query
 * @throws \RuntimeException if the slider does not exist
 */
function hyyan_slider_query($slider, $order = 'DESC', $orderBy = 'rand')
{
    $slider = esc_attr((string) $slider);
    /** check for term existance */
    if (!term_exists($slider, Hyyan_Slider::CUSTOM_TAXONOMY)) {
        throw new \RuntimeException(sprintf('Can not build query for %s slider - term does not exist', $slider));
    }
    if (function_exists('pll_get_term')) {
        // get slider object
        $term = get_term_by('slug', $slider, Hyyan_Slider::CUSTOM_TAXONOMY);
        $slider = $term->slug;
        if ($term) {
            // find the id of translated slider
            $id = pll_get_term($term->term_id);
            // get translated slider object
            $trans_term = get_term($id, Hyyan_Slider::CUSTOM_TAXONOMY);
            if ($trans_term && !$trans_term instanceof WP_Error) {
                $slider = $trans_term->slug;
            }
        }
    }
    /**
     * Query object
     * 
     * @see Hyyan_Slider_Shortcode::FILTER_SHORTCODE_QueryArgs
     * 
     * @var WP_Query 
     */
    $query = new WP_Query(apply_filters(Hyyan_Slider_Events::FILTER_SHORTCODE_QueryArgs, array('post_type' => Hyyan_Slider::CUSTOM_POST, 'taxonomy' => Hyyan_Slider::CUSTOM_TAXONOMY, 'term' => $slider, 'post_status' => 'publish', 'order' => esc_attr($order), 'orderby' => esc_attr($orderBy), 'posts_per_page' => -1, 'lang' => null)));
    return $query;
}
开发者ID:hyyan,项目名称:slider,代码行数:43,代码来源:functions.php


示例2: taxonomy

 /**
  *
  * Assigns random terms to all posts in a taxonomy.
  *
  * By default all objects of the 'post' post type will be randomized, use the
  * --post_type flag to target pages or a custom post type. Use the --include 
  * and --exclude flags to filter or ignore specific object IDs and the --before
  * and --after flags to specify a date range. Also, optionally pass --terms as
  * a list of terms you want to use for the randomization. If terms exist in the
  * target taxonomy, those terms will be used. If not, a string of 6 words 
  * generated randomly will be used for the randomization.
  * 
  * ## Options
  *
  * <taxonomy>
  * : The taxonomy that should get randomized
  *
  * ## Exmples
  *
  *     wp randomize category
  *     
  * @synopsis <taxonomy> [--include=<bar>] [--exclude=<foo>] [--post_type=<foo>] 
  * [--before=<bar>] [--after=<date>] [--terms=<terms>]
  * 
  **/
 public function taxonomy($args, $assoc_args)
 {
     $taxonomy = $args[0];
     $get_posts = $this->get_specified_posts($assoc_args);
     $message = $get_posts['message'];
     $posts = $get_posts['posts'];
     $args = $get_posts['args'];
     $preamble = "Will assign random {$taxonomy} terms";
     print_r("{$preamble} {$message}.\n");
     if (isset($assoc_args['terms'])) {
         $terms = explode(',', $assoc_args['terms']);
         \WP_CLI::log('Using terms ' . $assoc_args['terms']);
     } else {
         \WP_CLI::log('Gathering and processing random terms.');
         $terms = $this->get_random_terms();
         \WP_CLI::log('No term list given, using random terms.');
     }
     foreach ($posts as $p) {
         $index = array_rand($terms);
         $term = $terms[$index];
         \WP_CLI::log("Assigning {$term} to taxonomy {$taxonomy} for {$p->post_type} {$p->ID}");
         if (!term_exists($term, $taxonomy)) {
             wp_insert_term($term, $taxonomy);
         }
         wp_set_object_terms($p->ID, $term, $taxonomy, $append = false);
     }
 }
开发者ID:athaller,项目名称:cfpb-wp-cli,代码行数:52,代码来源:randomize.php


示例3: categorize

 private function categorize($post_id, $categories_str)
 {
     $categories_arr = explode(',', $categories_str);
     foreach ($categories_arr as $category) {
         $categories_par = explode('>', $category);
         if (!isset($categories_par[0], $categories_par[1])) {
             $this->err($category, $post_id);
         }
         $categories_par[0] = trim($categories_par[0]);
         $categories_par[1] = trim($categories_par[1]);
         $parent_term = term_exists($categories_par[0], 'venture_categories');
         if (!$parent_term) {
             $parent_term = wp_insert_term($categories_par[0], 'venture_categories');
         }
         $parent_term_id = intval($parent_term['term_id']);
         $term = term_exists($categories_par[1], 'venture_categories', $parent_term_id);
         if (!$term) {
             $term = wp_insert_term($categories_par[1], 'venture_categories', array('parent' => $parent_term_id));
         }
         if (is_wp_error($term)) {
             $this->err($category, $post_id);
         }
         $term_id = intval($term['term_id']);
         wp_set_object_terms($post_id, $parent_term_id, 'venture_categories', true);
         wp_set_object_terms($post_id, $term_id, 'venture_categories', true);
     }
 }
开发者ID:johnleesw,项目名称:mustardseedwp,代码行数:27,代码来源:Class_Import_Page.php


示例4: woocommerce_osc_run_cats

 function woocommerce_osc_run_cats($parent = 0, $parent_term_id = 0)
 {
     global $wpdb, $oscdb, $import_cat_counter;
     $categories = $oscdb->get_results("SELECT c.*, cd.* FROM categories c, categories_description cd WHERE c.categories_id=cd.categories_id AND cd.language_id=1 AND c.parent_id='" . (int) $parent . "'", ARRAY_A);
     if (!empty($categories)) {
         foreach ($categories as $category) {
             if (!is_wp_error($category)) {
                 $term = term_exists($category['categories_name'], 'product_cat', (int) $parent_term_id);
                 // array is returned if taxonomy is given
                 if ((int) $term['term_id'] == 0) {
                     $term = wp_insert_term($category['categories_name'], 'product_cat', array('parent' => $parent_term_id));
                     delete_option('product_cat_children');
                     // clear the cache
                     $attach_id = 0;
                     if ($category['categories_image'] != '') {
                         $url = rtrim($_POST['store_url'], '/') . '/images/' . urlencode($category['categories_image']);
                         $attach_id = woocommerce_osc_import_image($url);
                     }
                     add_woocommerce_term_meta($term['term_id'], 'order', $category['sort_order']);
                     add_woocommerce_term_meta($term['term_id'], 'display_type', '');
                     add_woocommerce_term_meta($term['term_id'], 'thumbnail_id', (int) $attach_id);
                     add_woocommerce_term_meta($term['term_id'], 'osc_id', $category['categories_id']);
                     woocommerce_osc_run_cats($category['categories_id'], $term['term_id']);
                     $import_cat_counter++;
                 } else {
                     woocommerce_osc_run_cats($category['categories_id'], $term['term_id']);
                 }
             }
         }
     }
 }
开发者ID:Korri,项目名称:woocommerce-etsy-importer,代码行数:31,代码来源:woocommerce-etsy-importer.php


示例5: initialize_container

 /**
  * initialize_container - Initialiaze the PAIR containers if the associated
  * option is checked
  *
  * @param  {type} $option    the checkbox to evaluate
  * @param  {type} $oldValue  the oldvalue (should be false)
  * @param  {type} $_newValue the new checkbox value (should be true)
  * @return {type}            description
  */
 function initialize_container($force = false)
 {
     if (isset($_GET['settings-updated']) || $force) {
         $ldp_container_init = get_option('ldp_container_init', false);
         if ($ldp_container_init || $force) {
             //TODO: Initialize the PAIR containers
             $pair_terms = array('initiative' => array('label' => __('Initiative', 'wpldp'), 'rdftype' => 'pair:initiative'), 'organization' => array('label' => __('Organization', 'wpldp'), 'rdftype' => 'foaf:organization'), 'group' => array('label' => __('Group', 'wpldp'), 'rdftype' => 'foaf:group'), 'document' => array('label' => __('Document', 'wpldp'), 'rdftype' => 'foaf:document'), 'goodorservice' => array('label' => __('Good or Service', 'wpldp'), 'rdftype' => 'goodRelation:goodOrService'), 'artwork' => array('label' => __('Artwork', 'wpldp'), 'rdftype' => 'schema:artwork'), 'event' => array('label' => __('Event', 'wpldp'), 'rdftype' => 'schema:event'), 'place' => array('label' => __('Place', 'wpldp'), 'rdftype' => 'schema:place'), 'theme' => array('label' => __('Theme', 'wpldp'), 'rdftype' => 'pair:theme'), 'thesis' => array('label' => __('Thesis', 'wpldp'), 'rdftype' => 'pair:thesis'), 'person' => array('label' => __('Person', 'wpldp'), 'rdftype' => 'pair:person'));
             foreach ($pair_terms as $term => $properties) {
                 // Loop on the models files (or hardcoded array) and push them each as taxonomy term in the database
                 $model = file_get_contents(__DIR__ . '/models/' . $term . '.json');
                 $term_id = null;
                 if (!term_exists($term, 'ldp_container')) {
                     $new_term = wp_insert_term($properties['label'], 'ldp_container', array('slug' => $term, 'description' => sprintf(__('The %1$s object model', 'wpldp'), $term)));
                     $term_id = $new_term['term_id'];
                 } else {
                     $existing_term = get_term_by('slug', $term, 'ldp_container');
                     $updated_term = wp_update_term($existing_term->term_id, 'ldp_container', array('slug' => $term, 'description' => sprintf(__('The %1$s object model', 'wpldp'), $term)));
                     $term_id = $existing_term->term_id;
                 }
                 if (!empty($term_id)) {
                     $term_meta = get_option("ldp_container_{$term_id}");
                     if (!is_array($term_meta)) {
                         $term_meta = array();
                     }
                     $term_meta['ldp_rdf_type'] = $properties['rdftype'];
                     $term_meta['ldp_model'] = stripslashes_deep($model);
                     update_option("ldp_container_{$term_id}", $term_meta);
                 }
             }
         }
     }
 }
开发者ID:assemblee-virtuelle,项目名称:wpldp,代码行数:41,代码来源:wpldp-settings.php


示例6: initialize_container

 /**
  * initialize_container - Initialiaze the PAIR containers if the associated
  * option is checked
  *
  * @param  {type} $option    the checkbox to evaluate
  * @param  {type} $oldValue  the oldvalue (should be false)
  * @param  {type} $_newValue the new checkbox value (should be true)
  * @return {type}            description
  */
 function initialize_container()
 {
     if (isset($_GET['settings-updated'])) {
         $ldp_container_init = get_option('ldp_container_init', false);
         if ($ldp_container_init) {
             //TODO: Initialize the PAIR containers
             $pair_terms = array('project', 'actor', 'idea', 'resource');
             foreach ($pair_terms as $term) {
                 // 1 - Check if they do not exists
                 if (!term_exists($term, 'ldp_container')) {
                     //   - Else, loop on the models files (or hardcoded array) and push them each as taxonomy term in the database
                     $model = file_get_contents(__DIR__ . '/models/' . $term . '_model.json');
                     $new_term = wp_insert_term(ucfirst($term), 'ldp_container', array('slug' => $term, 'description' => 'The ' . $term . ' object model'));
                     $term_id = $new_term['term_id'];
                     $term_meta = get_option("ldp_container_{$term_id}");
                     if (!is_array($term_meta)) {
                         $term_meta = array();
                     }
                     $term_meta['ldp_model'] = stripslashes_deep($model);
                     update_option("ldp_container_{$term_id}", $term_meta);
                 }
             }
         }
     }
 }
开发者ID:Open-Initiative,项目名称:wpldp,代码行数:34,代码来源:wpldp-settings.php


示例7: save_new_episode

 public function save_new_episode($item, $show_slug)
 {
     $item_date = $item->get_date('Y-m-d H:i:s');
     $enclosure = $item->get_enclosure();
     $post = array('post_title' => $item->get_title(), 'post_date' => $item_date, 'post_content' => $item->get_description(), 'post_status' => 'publish', 'post_type' => Dipo_Podcast_Post_Type::POST_TYPE, 'tags_input' => $enclosure->get_keywords());
     $post_id = wp_insert_post($post);
     if (!empty($show_slug)) {
         $term_id = term_exists($show_slug, 'podcast_show');
         wp_set_post_terms($post_id, $term_id, 'podcast_show');
     }
     // save episodes data as metadata for post
     $subtitle = htmlspecialchars($this->get_subtitle($item));
     update_post_meta($post_id, '_dipo_subtitle', $subtitle);
     $summary = htmlspecialchars($this->get_summary($item));
     update_post_meta($post_id, '_dipo_summary', $summary);
     $explicit = htmlspecialchars(strtolower($this->get_explicit($item)));
     $possible_values = array('yes', 'no', 'clean');
     if (in_array($explicit, $possible_values)) {
         update_post_meta($post_id, '_dipo_explicit', $explicit);
     }
     $medialink = esc_url_raw($enclosure->get_link());
     $type = htmlspecialchars($enclosure->get_type());
     $duration = htmlspecialchars($enclosure->get_duration('hh:mm:ss'));
     $length = htmlspecialchars($enclosure->get_length());
     $mediafile = array('id' => 1, 'medialink' => $medialink, 'mediatype' => $type, 'duration' => $duration, 'filesize' => $length);
     update_post_meta($post_id, '_dipo_mediafile1', $mediafile);
     update_post_meta($post_id, '_dipo_max_mediafile_number', '1');
     $this->created_episodes++;
     return $post_id;
 }
开发者ID:ICFMovement,项目名称:dicentis,代码行数:30,代码来源:class-dipo-feed-import.php


示例8: filter_query_request

 public function filter_query_request($args)
 {
     global $portfolio_page_name;
     if (is_admin()) {
         return $args;
     }
     // Make sure no 404 error is thrown for any sub pages of products-page
     if (!empty($args['portfolio_cat']) && 'page' != $args['portfolio_cat'] && !term_exists($args['portfolio_cat'], 'portfolio_cat')) {
         // Probably requesting a page that is a sub page of products page
         $pagename = $portfolio_page_name . "/{$args['portfolio_cat']}";
         if (isset($args['name'])) {
             $pagename .= "/{$args['name']}";
         }
         $args = array();
         $args['pagename'] = $pagename;
     }
     // When product page is set to display all products or a category, and pagination is enabled, $wp_query is messed up
     // and is_home() is true. This fixes that.
     if (isset($args['post_type']) && 'a3-portfolio' == $args['post_type'] && !empty($args['a3-portfolio']) && isset($args['portfolio_cat']) && 'page' == $args['portfolio_cat']) {
         $page = $args['a3-portfolio'];
         $args = array();
         $args['pagename'] = $portfolio_page_name;
         $args['page'] = $page;
     }
     return $args;
 }
开发者ID:manhhung86it,项目名称:builder-site,代码行数:26,代码来源:class-a3-portfolio-template-loader.php


示例9: add_mediatags_alternate_link

function add_mediatags_alternate_link()
{
    global $wp_version;
    $mediatag_rss_feed = get_option('mediatag_rss_feed', 'yes');
    if (!$mediatag_rss_feed || $mediatag_rss_feed != "yes") {
        return;
    }
    $mediatag_var = get_query_var(MEDIA_TAGS_QUERYVAR);
    //echo "mediatag_var<pre>"; print_r($mediatag_var); echo "</pre>";
    if ($mediatag_var) {
        if (version_compare($wp_version, '3.0', '<')) {
            $mediatag_term = is_term($mediatag_var, MEDIA_TAGS_TAXONOMY);
        } else {
            $mediatag_term = term_exists($mediatag_var, MEDIA_TAGS_TAXONOMY);
        }
        if ($mediatag_term) {
            $mediatag_term = get_term($mediatag_term['term_id'], MEDIA_TAGS_TAXONOMY);
            $feed_title = get_bloginfo('name') . " &raquo; " . __('Media-Tags RSS Feed', MEDIA_TAGS_I18N_DOMAIN) . " &raquo; " . $mediatag_term->name;
            $feed_link = get_mediatag_link($mediatag_term->term_id, true);
            if ($feed_link) {
                ?>
<link id="MediaTagsRSS" rel="alternate" type="application/rss+xml"
					title="<?php 
                echo $feed_title;
                ?>
" 
					href="<?php 
                echo $feed_link;
                ?>
" />
				<?php 
            }
        }
    }
}
开发者ID:vsalx,项目名称:rattieinfo,代码行数:35,代码来源:mediatags_feed.php


示例10: rcl_update_grouppost_meta

function rcl_update_grouppost_meta($post_id, $postdata, $action)
{
    if ($postdata['post_type'] != 'post-group') {
        return false;
    }
    if (isset($_POST['term_id'])) {
        $term_id = intval(base64_decode($_POST['term_id']));
    }
    if (isset($term_id)) {
        wp_set_object_terms($post_id, (int) $term_id, 'groups');
    }
    $gr_tag = sanitize_text_field($_POST['group-tag']);
    if ($gr_tag) {
        if (!$term_id) {
            $groups = get_the_terms($post_id, 'groups');
            foreach ($groups as $group) {
                if ($group->parent != 0) {
                    continue;
                }
                $group_id = $group->term_id;
            }
        } else {
            $group_id = $term_id;
        }
        $term = term_exists($gr_tag, 'groups', $group_id);
        if (!$term) {
            $term = wp_insert_term($gr_tag, 'groups', array('description' => '', 'slug' => '', 'parent' => $group_id));
        }
        wp_set_object_terms($post_id, array((int) $term['term_id'], (int) $group_id), 'groups');
    }
}
开发者ID:stanislav-chechun,项目名称:campus-rize,代码行数:31,代码来源:groups-public.php


示例11: init_attribute_image_selector

 public function init_attribute_image_selector()
 {
     global $woocommerce, $_wp_additional_image_sizes;
     $screen = get_current_screen();
     if (strpos($screen->id, 'pa_') !== false) {
         $this->taxonomy = $_REQUEST['taxonomy'];
         if (taxonomy_exists($_REQUEST['taxonomy'])) {
             $term_id = term_exists(isset($_REQUEST['tag_ID']) ? $_REQUEST['tag_ID'] : 0, $_REQUEST['taxonomy']);
             $term = 0;
             if ($term_id) {
                 $term = get_term($term_id, $_REQUEST['taxonomy']);
             }
             $this->image_size = apply_filters('woocommerce_get_swatches_image_size', $this->image_size, $_REQUEST['taxonomy'], $term_id);
         }
         $the_size = isset($_wp_additional_image_sizes[$this->image_size]) ? $_wp_additional_image_sizes[$this->image_size] : $_wp_additional_image_sizes['shop_thumbnail'];
         if (isset($the_size['width']) && isset($the_size['height'])) {
             $this->image_width = $the_size['width'];
             $this->image_height = $the_size['height'];
         } else {
             $this->image_width = 32;
             $this->image_height = 32;
         }
         $attribute_taxonomies = WC_Swatches_Compatibility::wc_get_attribute_taxonomies();
         if ($attribute_taxonomies) {
             foreach ($attribute_taxonomies as $tax) {
                 add_action('pa_' . $tax->attribute_name . '_add_form_fields', array(&$this, 'woocommerce_add_attribute_thumbnail_field'));
                 add_action('pa_' . $tax->attribute_name . '_edit_form_fields', array(&$this, 'woocommerce_edit_attributre_thumbnail_field'), 10, 2);
                 add_filter('manage_edit-pa_' . $tax->attribute_name . '_columns', array(&$this, 'woocommerce_product_attribute_columns'));
                 add_filter('manage_pa_' . $tax->attribute_name . '_custom_column', array(&$this, 'woocommerce_product_attribute_column'), 10, 3);
             }
         }
     }
 }
开发者ID:k2jysy,项目名称:kshop,代码行数:33,代码来源:class-wc-swatches-product-attribute-images.php


示例12: wdm_modified_bid_place

function wdm_modified_bid_place($args)
{
    global $wpdb;
    $wpdb->show_errors();
    $wpdb->insert($wpdb->prefix . 'wdm_bidders', array('name' => $args['orig_name'], 'email' => $args['orig_email'], 'auction_id' => $args['auc_id'], 'bid' => $args['orig_bid'], 'date' => date("Y-m-d H:i:s", time())), array('%s', '%s', '%d', '%f', '%s'));
    update_post_meta($args['auc_id'], 'wdm_previous_bid_value', $args['mod_bid']);
    //store bid value of the most recent bidder
    $place_bid = $wpdb->insert($wpdb->prefix . 'wdm_bidders', array('name' => $args['mod_name'], 'email' => $args['mod_email'], 'auction_id' => $args['auc_id'], 'bid' => $args['mod_bid'], 'date' => date("Y-m-d H:i:s", time())), array('%s', '%s', '%d', '%f', '%s'));
    if ($place_bid) {
        $c_code = substr(get_option('wdm_currency'), -3);
        $char = $args['site_char'];
        $ret_url = $args['auc_url'];
        $adm_email = get_option("wdm_auction_email");
        if ($args['email_type'] === 'winner') {
            update_post_meta($args['auc_id'], 'wdm_listing_ends', date("Y-m-d H:i:s", time()));
            $check_term = term_exists('expired', 'auction-status');
            wp_set_post_terms($args['auc_id'], $check_term["term_id"], 'auction-status');
            update_post_meta($args['auc_id'], 'email_sent_imd', 'sent_imd');
            $args['stat'] = "Won";
        } else {
            $args['stat'] = "Placed";
        }
        $args['adm_email'] = $adm_email;
        $args['ret_url'] = $ret_url;
        $args['type'] = 'proxy';
        echo json_encode($args);
    }
}
开发者ID:tvolmari,项目名称:hammydowns,代码行数:28,代码来源:ua-proxy-bidding.php


示例13: register_emrede_taxonomies

function register_emrede_taxonomies()
{
    $labels = array('name' => __('Público Alvo', 'fluxo'), 'singular_name' => __('Público Alvo', 'fluxo'), 'search_items' => __('Procurar em Público Alvo', 'fluxo'), 'all_items' => __('Todos os Públicos Alvos', 'fluxo'), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __('Editar Público Alvo', 'fluxo'), 'update_item' => __('Atualizar um Público Alvo', 'fluxo'), 'add_new_item' => __('Adicionar Novo Público Alvo', 'fluxo'), 'add_new' => __('Adicionar Público Alvo', 'fluxo'), 'new_item_name' => __('Novo Público Alvo', 'fluxo'), 'view_item' => __('Visualizar Público Alvo', 'fluxo'), 'not_found' => __('Nenhum Público Alvo localizado', 'fluxo'), 'not_found_in_trash' => __('Nenhum Público Alvo localizado na lixeira', 'fluxo'), 'menu_name' => __('Público Alvo', 'fluxo'));
    register_taxonomy('publico-alvo', array('emrede'), array('hierarchical' => true, 'label' => 'Público Alvo', 'show_ui' => true, 'query_var' => true, 'show_admin_column' => true, 'labels' => $labels));
    if (!term_exists('Público em Geral', 'publico-alvo')) {
        wp_insert_term("Coletivos, artistas", 'publico-alvo');
        wp_insert_term("comunidades", 'publico-alvo');
        wp_insert_term("Crianças, jovens e adultos", 'publico-alvo');
        wp_insert_term("Desenvolvedores", 'publico-alvo');
        wp_insert_term("Educadores", 'publico-alvo');
        wp_insert_term("Indígenas", 'publico-alvo');
        wp_insert_term("Jovens", 'publico-alvo');
        wp_insert_term("Jovens e adultos", 'publico-alvo');
        wp_insert_term("Jovens, adultos, idosos", 'publico-alvo');
        wp_insert_term("juristas, sociólogos, economistas", 'publico-alvo');
        wp_insert_term("Militantes e pesquisadores que atuam no Direito à Cidade", 'publico-alvo');
        wp_insert_term("Militantes pela cultura", 'publico-alvo');
        wp_insert_term("Movimentos sociais", 'publico-alvo');
        wp_insert_term("organizaciones sociales, comunitarias, sindicales, movimientos de base, fundaciones, asociaciones civiles, cooperativas, empresas recuperadas, bancos populare", 'publico-alvo');
        wp_insert_term("Produtores culturais", 'publico-alvo');
        wp_insert_term("Produtores e artistas", 'publico-alvo');
        wp_insert_term("Produtores, gestores e articuladores culturais", 'publico-alvo');
        wp_insert_term("professores e lideranças populares", 'publico-alvo');
        wp_insert_term("Público em Geral", 'publico-alvo');
        wp_insert_term("artistas e arte-educadores de coletivos e Pontos de Cultura", 'publico-alvo');
        wp_insert_term("Rádios comunitárias", 'publico-alvo');
        wp_insert_term("Segmentos Populares", 'publico-alvo');
        wp_insert_term("Outro#input#", 'publico-alvo');
    }
}
开发者ID:redelivre,项目名称:fluxo,代码行数:30,代码来源:taxs.php


示例14: woocommerce_init

 function woocommerce_init()
 {
     // create our Accommodation, Tour and Car Rental woocommerce categories
     if (!term_exists(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_ACCOMMODATIONS, 'product_cat')) {
         $this->woocommerce_create_product_category(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_ACCOMMODATIONS, __('Accommodations', 'bookyourtravel'), __('Accommodations category', 'bookyourtravel'));
     }
     if (!term_exists(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_TOURS, 'product_cat')) {
         $this->woocommerce_create_product_category(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_TOURS, __('Tours', 'bookyourtravel'), __('Tours Category', 'bookyourtravel'));
     }
     if (!term_exists(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_CAR_RENTALS, 'product_cat')) {
         $this->woocommerce_create_product_category(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_CAR_RENTALS, __('Car rentals', 'bookyourtravel'), __('Car Rentals Category', 'bookyourtravel'));
     }
     if (!term_exists(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_CRUISES, 'product_cat')) {
         $this->woocommerce_create_product_category(BOOKYOURTRAVEL_WOO_PRODUCT_CAT_CRUISES, __('Cruises', 'bookyourtravel'), __('Cruises Category', 'bookyourtravel'));
     }
     // modify cart item name and link
     add_filter('woocommerce_cart_item_name', array($this, 'woocommerce_modify_cart_product_title'), 20, 3);
     add_filter('woocommerce_order_item_name', array($this, 'woocommerce_modify_order_product_title'), 20, 2);
     // prefill checkout form
     add_filter('woocommerce_checkout_get_value', array($this, 'woocommerce_checkout_get_value'), 20, 2);
     add_action('woocommerce_order_status_completed', array($this, 'woocommerce_handle_woo_payment'));
     // Add reservetions to Booking System after payment has been completed.
     add_action('woocommerce_order_status_pending_to_processing', array($this, 'woocommerce_handle_woo_payment'));
     // Add reservetions to Booking System after payment has been completed.
     add_action('woocommerce_order_status_pending_to_on-hold', array($this, 'woocommerce_handle_woo_payment'));
     // Add reservetions to Booking System after payment has been completed.
     add_action('woocommerce_order_status_failed_to_processing', array($this, 'woocommerce_handle_woo_payment'));
     // Add reservetions to Booking System after payment has been completed.
     // remove woocommerce breadcrumbs since BYT has it's own
     remove_action('woocommerce_before_main_content', array($this, 'woocommerce_breadcrumb'), 20);
     // override woocommerce template to not show
     // single-product.php, taxonomy-product_cat.php, taxonomy-product_tag.php, archive-product.php
     // as we don't need them for byt
     add_filter('template_include', array($this, 'woocommerce_template_include'));
 }
开发者ID:alikris,项目名称:OTA,代码行数:35,代码来源:theme_woocommerce.php


示例15: wpsc_filter_query_request

/**
 * Fixes for some inconsistencies about $wp_query when viewing WPEC pages.
 *
 * Causes the following URLs to work (with pagination enabled):
 *
 * /products-page/ (product listing)
 * /products-page/car-audio/ (existing product category)
 * /products-page/car-audio/page/2/ (existing product category, page 2)
 * /products-page/page/2/  (product listing, page 2)
 * /products-page/checkout/  (existing built-in sub page)
 * /products-page/anotherpage/  (another sub page that may exist)
 *
 * @param string $q Query String
 */
function wpsc_filter_query_request($args)
{
    global $wpsc_page_titles;
    if (is_admin()) {
        return $args;
    }
    $is_sub_page = !empty($args['wpsc_product_category']) && 'page' != $args['wpsc_product_category'] && !term_exists($args['wpsc_product_category'], 'wpsc_product_category');
    // Make sure no 404 error is thrown for any sub pages of products-page
    if ($is_sub_page) {
        // Probably requesting a page that is a sub page of products page
        $pagename = "{$wpsc_page_titles['products']}/{$args['wpsc_product_category']}";
        if (isset($args['name'])) {
            $pagename .= "/{$args['name']}";
        }
        $args = array();
        $args['pagename'] = $pagename;
    }
    // When product page is set to display all products or a category, and pagination is enabled, $wp_query is messed up
    // and is_home() is true. This fixes that.
    $needs_pagination_fix = isset($args['post_type']) && !empty($args['wpsc_product_category']) && 'wpsc-product' == $args['post_type'] && !empty($args['wpsc-product']) && 'page' == $args['wpsc_product_category'];
    if ($needs_pagination_fix) {
        $default_category = get_option('wpsc_default_category');
        if ($default_category == 'all' || $default_category != 'list') {
            $page = $args['wpsc-product'];
            $args = array();
            $args['pagename'] = "{$wpsc_page_titles['products']}";
            $args['page'] = $page;
        }
    }
    return $args;
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:45,代码来源:query.php


示例16: test_wp_insert_delete_term

 public function test_wp_insert_delete_term()
 {
     $taxonomy = 'wptests_tax';
     register_taxonomy($taxonomy, 'post');
     // a new unused term
     $term = rand_str();
     $this->assertNull(term_exists($term));
     $initial_count = wp_count_terms($taxonomy);
     $t = wp_insert_term($term, $taxonomy);
     $this->assertInternalType('array', $t);
     $this->assertNotWPError($t);
     $this->assertTrue($t['term_id'] > 0);
     $this->assertTrue($t['term_taxonomy_id'] > 0);
     $this->assertEquals($initial_count + 1, wp_count_terms($taxonomy));
     // make sure the term exists
     $this->assertTrue(term_exists($term) > 0);
     $this->assertTrue(term_exists($t['term_id']) > 0);
     // now delete it
     add_filter('delete_term', array($this, 'deleted_term_cb'), 10, 5);
     $this->assertTrue(wp_delete_term($t['term_id'], $taxonomy));
     remove_filter('delete_term', array($this, 'deleted_term_cb'), 10, 5);
     $this->assertNull(term_exists($term));
     $this->assertNull(term_exists($t['term_id']));
     $this->assertEquals($initial_count, wp_count_terms($taxonomy));
 }
开发者ID:dd32,项目名称:wordpress.develop,代码行数:25,代码来源:wpInsertTerm.php


示例17: _mla_ajax_add_flat_term

 /**
  * Add flat taxonomy term from "checklist" meta box on the Media Manager Modal Window
  *
  * Adapted from the WordPress post_categories_meta_box() in /wp-admin/includes/meta-boxes.php.
  *
  * @since 2.20
  *
  * @param string The taxonomy name, from $_POST['action']
  *
  * @return void Sends JSON response with updated HTML for the checklist
  */
 private static function _mla_ajax_add_flat_term($key)
 {
     $taxonomy = get_taxonomy($key);
     check_ajax_referer($_POST['action'], '_ajax_nonce-add-' . $key, true);
     if (!current_user_can($taxonomy->cap->edit_terms)) {
         wp_die(-1);
     }
     $new_names = explode(',', $_POST['new' . $key]);
     $new_terms_markup = '';
     foreach ($new_names as $name) {
         if ('' === sanitize_title($name)) {
             continue;
         }
         if (!($id = term_exists($name, $key))) {
             $id = wp_insert_term($name, $key);
         }
         if (is_wp_error($id)) {
             continue;
         }
         if (is_array($id)) {
             $id = absint($id['term_id']);
         } else {
             continue;
         }
         $term = get_term($id, $key);
         $name = $term->name;
         $new_terms_markup .= "<li id='{$key}-{$id}'><label class='selectit'><input value='{$name}' type='checkbox' name='tax_input[{$key}][]' id='in-{$key}-{$id}' checked='checked' />{$name}</label></li>\n";
     }
     // foreach new_name
     $input_new_parent_name = "new{$key}_parent";
     $supplemental = "<input type='hidden' name='{$input_new_parent_name}' id='{$input_new_parent_name}' value='-1' />";
     $add = array('what' => $key, 'id' => $id, 'data' => $new_terms_markup, 'position' => -1, 'supplemental' => array('newcat_parent' => $supplemental));
     $x = new WP_Ajax_Response($add);
     $x->send();
 }
开发者ID:jonpetersen,项目名称:PHTC,代码行数:46,代码来源:class-mla-ajax.php


示例18: build_genre_taxonomies

function build_genre_taxonomies()
{
    $parent_term = term_exists('genres', 'genres');
    // array is returned if taxonomy is given
    $parent_term_id = $parent_term['term_id'];
    // get numeric term id
    wp_insert_term('Science fiction', 'genres', array('description' => '', 'slug' => 'scifi', 'parent' => $parent_term_id));
    wp_insert_term('Satire', 'genres', array('description' => '', 'slug' => 'satire', 'parent' => $parent_term_id));
    wp_insert_term('Drama', 'genres', array('description' => '', 'slug' => 'drama', 'parent' => $parent_term_id));
    wp_insert_term('Romance', 'genres', array('description' => '', 'slug' => 'romance', 'parent' => $parent_term_id));
    wp_insert_term('Mystery', 'genres', array('description' => '', 'slug' => 'mystery', 'parent' => $parent_term_id));
    wp_insert_term('Horror', 'genres', array('description' => '', 'slug' => 'horror', 'parent' => $parent_term_id));
    wp_insert_term('Self help', 'genres', array('description' => '', 'slug' => 'self-help', 'parent' => $parent_term_id));
    wp_insert_term('Guide', 'genres', array('description' => '', 'slug' => 'guide', 'parent' => $parent_term_id));
    wp_insert_term('Travel', 'genres', array('description' => '', 'slug' => 'travel', 'parent' => $parent_term_id));
    wp_insert_term('Children', 'genres', array('description' => '', 'slug' => 'children', 'parent' => $parent_term_id));
    wp_insert_term('Religious', 'genres', array('description' => '', 'slug' => 'religious', 'parent' => $parent_term_id));
    wp_insert_term('Science', 'genres', array('description' => '', 'slug' => 'science', 'parent' => $parent_term_id));
    wp_insert_term('History', 'genres', array('description' => '', 'slug' => 'history', 'parent' => $parent_term_id));
    wp_insert_term('Anthologies', 'genres', array('description' => '', 'slug' => 'anthologies', 'parent' => $parent_term_id));
    wp_insert_term('Poetry', 'genres', array('description' => '', 'slug' => 'poetry', 'parent' => $parent_term_id));
    wp_insert_term('Encyclopedia', 'genres', array('description' => '', 'slug' => 'encyclopedia', 'parent' => $parent_term_id));
    wp_insert_term('Dictionary', 'genres', array('description' => '', 'slug' => 'dictionary', 'parent' => $parent_term_id));
    wp_insert_term('Comic', 'genres', array('description' => '', 'slug' => 'comic', 'parent' => $parent_term_id));
    wp_insert_term('Art', 'genres', array('description' => '', 'slug' => 'art', 'parent' => $parent_term_id));
    wp_insert_term('Cookbook', 'genres', array('description' => '', 'slug' => 'cookbook', 'parent' => $parent_term_id));
    wp_insert_term('Diary', 'genres', array('description' => '', 'slug' => 'diary', 'parent' => $parent_term_id));
    wp_insert_term('Journal', 'genres', array('description' => '', 'slug' => 'journal', 'parent' => $parent_term_id));
    wp_insert_term('Prayer', 'genres', array('description' => '', 'slug' => 'prayer', 'parent' => $parent_term_id));
    wp_insert_term('Series', 'genres', array('description' => '', 'slug' => 'series', 'parent' => $parent_term_id));
    wp_insert_term('Trilogy', 'genres', array('description' => '', 'slug' => 'trilogy', 'parent' => $parent_term_id));
    wp_insert_term('Biography', 'genres', array('description' => '', 'slug' => 'biography', 'parent' => $parent_term_id));
    wp_insert_term('Autobiography', 'genres', array('description' => '', 'slug' => 'autobiography', 'parent' => $parent_term_id));
    wp_insert_term('Fantasy', 'genres', array('description' => '', 'slug' => 'Fantasy', 'parent' => $parent_term_id));
}
开发者ID:ibuilder,项目名称:wp-booklibrary,代码行数:35,代码来源:library.php


示例19: dt_geodir_default_taxonomies

function dt_geodir_default_taxonomies($post_type, $categories, $folder_name)
{
    global $wpdb, $dummy_image_path;
    $cat_count = count($categories);
    for ($i = 0; $i < $cat_count; $i++) {
        $parent_catid = 0;
        if (is_array($categories[$i])) {
            $cat_name_arr = $categories[$i];
            $count_cat_name_arr = count($cat_name_arr);
            for ($j = 0; $j < $count_cat_name_arr; $j++) {
                $catname = $cat_name_arr[$j];
                if (!term_exists($catname, $post_type . 'category')) {
                    $last_catid = wp_insert_term($catname, $post_type . 'category', $args = array('parent' => $parent_catid));
                    if ($j == 0) {
                        $parent_catid = $last_catid;
                    }
                    dt_geodir_insert_taxonomy($post_type, $catname, $folder_name, $last_catid);
                }
            }
        } else {
            $catname = $categories[$i];
            if (!term_exists($catname, $post_type . 'category')) {
                $last_catid = wp_insert_term($catname, $post_type . 'category');
                dt_geodir_insert_taxonomy($post_type, $catname, $folder_name, $last_catid);
            }
        }
    }
}
开发者ID:mistergiri,项目名称:directory-starter,代码行数:28,代码来源:dummy.php


示例20: aitGridPortfolioTaxonomies

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP term_is_ancestor_of函数代码示例发布时间:2022-05-23
下一篇:
PHP term_description函数代码示例发布时间: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