本文整理汇总了PHP中get_taxonomies_by_object_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_taxonomies_by_object_type函数的具体用法?PHP get_taxonomies_by_object_type怎么用?PHP get_taxonomies_by_object_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_taxonomies_by_object_type函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wp_all_export_get_existing_taxonomies_by_cpt
function wp_all_export_get_existing_taxonomies_by_cpt($post_type = false)
{
if (empty($post_type)) {
return array();
}
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip(array('post_format')));
$_existing_taxonomies = array();
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $tx) {
if (strpos($tx->name, "pa_") !== 0) {
$_existing_taxonomies[] = array('name' => $tx->label, 'label' => $tx->name, 'type' => 'cats');
}
}
}
return $_existing_taxonomies;
}
开发者ID:BennyHudson,项目名称:eaton,代码行数:16,代码来源:pmxe_functions.php
示例2: _e
<div class="input">
<input type="hidden" name="taxonomies_list" value="0" />
<input type="hidden" name="is_update_categories" value="0" />
<input type="checkbox" id="is_update_categories" name="is_update_categories" value="1" class="switcher" <?php
echo $post['is_update_categories'] ? 'checked="checked"' : '';
?>
/>
<label for="is_update_categories"><?php
_e('Taxonomies (incl. Categories and Tags)', 'wp_all_import_plugin');
?>
</label>
<div class="switcher-target-is_update_categories" style="padding-left:17px;">
<?php
$existing_taxonomies = array();
$hide_taxonomies = class_exists('PMWI_Plugin') ? array('product_type') : array();
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type($post['is_override_post_type'] ? array_keys(get_post_types('', 'names')) : array($post_type), 'object'), array_flip($hide_taxonomies));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
if ("" == $ctx->labels->name or class_exists('PMWI_Plugin') and $post_type == "product" and strpos($ctx->name, "pa_") === 0) {
continue;
}
$existing_taxonomies[] = $ctx->name;
}
}
?>
<div class="input" style="margin-bottom:3px;">
<input type="radio" id="update_categories_logic_all_except" name="update_categories_logic" value="all_except" <?php
echo "all_except" == $post['update_categories_logic'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="update_categories_logic_all_except"><?php
开发者ID:seoduda,项目名称:Patua,代码行数:31,代码来源:_reimport_options.php
示例3: process
//.........这里部分代码省略.........
in_array($d, $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'wp_all_import_plugin'), $warned[] = $d));
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
$time = time();
}
$dates[$i] = date('Y-m-d H:i:s', $time);
}
} else {
$dates_start = XmlImportParser::factory($xml, $cxpath, $this->options['date_start'], $file)->parse($records);
$tmp_files[] = $file;
$dates_end = XmlImportParser::factory($xml, $cxpath, $this->options['date_end'], $file)->parse($records);
$tmp_files[] = $file;
$warned = array();
// used to prevent the same notice displaying several times
foreach ($dates_start as $i => $d) {
$time_start = strtotime($dates_start[$i]);
if (FALSE === $time_start) {
in_array($dates_start[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'wp_all_import_plugin'), $warned[] = $dates_start[$i]));
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
$time_start = time();
}
$time_end = strtotime($dates_end[$i]);
if (FALSE === $time_end) {
in_array($dates_end[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'wp_all_import_plugin'), $warned[] = $dates_end[$i]));
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
$time_end = time();
}
$dates[$i] = date('Y-m-d H:i:s', mt_rand($time_start, $time_end));
}
}
// [custom taxonomies]
require_once ABSPATH . 'wp-admin/includes/taxonomy.php';
$taxonomies = array();
$exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', class_exists('PMWI_Plugin') ? array('post_format', 'product_type', 'product_shipping_class') : array('post_format'));
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
if ("" == $ctx->labels->name or class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $this->options['custom_type'] == "product") {
continue;
}
$chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'wp_all_import_plugin'), $ctx->labels->name));
$tx_name = $ctx->name;
$mapping_rules = !empty($this->options['tax_mapping'][$tx_name]) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
$taxonomies[$tx_name] = array();
if (!empty($this->options['tax_logic'][$tx_name]) and !empty($this->options['tax_assing'][$tx_name])) {
switch ($this->options['tax_logic'][$tx_name]) {
case 'single':
if (!empty($this->options['tax_single_xpath'][$tx_name])) {
$txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_single_xpath'][$tx_name], $file)->parse($records);
$tmp_files[] = $file;
foreach ($txes as $i => $tx) {
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array('name' => $tx, 'parent' => false, 'assign' => isset($this->options['term_assing'][$tx_name]) ? $this->options['term_assing'][$tx_name] : true, 'is_mapping' => !empty($this->options['tax_enable_mapping'][$tx_name]), 'hierarchy_level' => 1, 'max_hierarchy_level' => 1), $mapping_rules, $tx_name);
}
}
break;
case 'multiple':
if (!empty($this->options['tax_multiple_xpath'][$tx_name])) {
$txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_multiple_xpath'][$tx_name], $file)->parse($records);
$tmp_files[] = $file;
foreach ($txes as $i => $tx) {
$_tx = $tx;
// apply mapping rules before splitting via separator symbol
if (!empty($this->options['tax_enable_mapping'][$tx_name]) and !empty($this->options['tax_logic_mapping'][$tx_name])) {
if (!empty($mapping_rules)) {
foreach ($mapping_rules as $rule) {
if (!empty($rule[trim($_tx)])) {
$_tx = trim($rule[trim($_tx)]);
开发者ID:k-hasan-19,项目名称:wp-all-import,代码行数:67,代码来源:record.php
示例4: pmwi_pmxi_reimport
function pmwi_pmxi_reimport($entry, $post)
{
if ($entry != 'product' and empty($post['is_override_post_type'])) {
return;
}
$all_existing_attributes = array();
$hide_taxonomies = array('product_type');
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($entry), 'object'), array_flip($hide_taxonomies));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
if ("" == $ctx->labels->name or strpos($ctx->name, "pa_") === false) {
continue;
}
$all_existing_attributes[] = $ctx->name;
}
}
if (!empty($existing_attributes)) {
foreach ($existing_attributes as $key => $attr) {
$all_existing_attributes[] = $attr;
}
}
?>
<div class="input">
<input type="hidden" name="is_update_product_type" value="0" />
<input type="checkbox" id="is_update_product_type_<?php
echo $entry;
?>
" name="is_update_product_type" value="1" <?php
echo $post['is_update_product_type'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="is_update_product_type_<?php
echo $entry;
?>
"><?php
_e('Product Type', 'pmxi_plugin');
?>
</label>
</div>
<div class="input">
<input type="hidden" name="attributes_list" value="0" />
<input type="hidden" name="is_update_attributes" value="0" />
<input type="checkbox" id="is_update_attributes_<?php
echo $entry;
?>
" name="is_update_attributes" value="1" <?php
echo $post['is_update_attributes'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="is_update_attributes_<?php
echo $entry;
?>
"><?php
_e('Attributes', 'pmxi_plugin');
?>
</label>
<!--a href="#help" class="help" title="<?php
_e('If Keep Custom Fields box is checked, it will keep all Custom Fields, and add any new Custom Fields specified in Custom Fields section, as long as they do not overwrite existing fields. If \'Only keep this Custom Fields\' is specified, it will only keep the specified fields.', 'pmxi_plugin');
?>
">?</a-->
<div class="switcher-target-is_update_attributes_<?php
echo $entry;
?>
" style="padding-left:17px;">
<div class="input">
<input type="radio" id="update_attributes_logic_full_update_<?php
echo $entry;
?>
" name="update_attributes_logic" value="full_update" <?php
echo "full_update" == $post['update_attributes_logic'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="update_attributes_logic_full_update_<?php
echo $entry;
?>
"><?php
_e('Update all Attributes', 'pmxi_plugin');
?>
</label>
</div>
<div class="input">
<input type="radio" id="update_attributes_logic_only_<?php
echo $entry;
?>
" name="update_attributes_logic" value="only" <?php
echo "only" == $post['update_attributes_logic'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="update_attributes_logic_only_<?php
echo $entry;
?>
"><?php
_e('Update only these Attributes, leave the rest alone', 'pmxi_plugin');
?>
</label>
<div class="switcher-target-update_attributes_logic_only_<?php
echo $entry;
?>
pmxi_choosen" style="padding-left:17px;">
//.........这里部分代码省略.........
开发者ID:hikaram,项目名称:wee,代码行数:101,代码来源:pmxi_reimport.php
示例5: pmwi_pmxi_reimport
function pmwi_pmxi_reimport($post_type, $post)
{
if (!in_array($post_type, array('product')) and empty($post['is_override_post_type']) or !class_exists('WooCommerce')) {
return;
}
switch ($post_type) {
case 'product':
$all_existing_attributes = array();
$hide_taxonomies = array('product_type');
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($hide_taxonomies));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
if ("" == $ctx->labels->name or strpos($ctx->name, "pa_") === false) {
continue;
}
$all_existing_attributes[] = $ctx->name;
}
}
if (!empty($existing_attributes)) {
foreach ($existing_attributes as $key => $attr) {
$all_existing_attributes[] = $attr;
}
}
?>
<div class="input">
<input type="hidden" name="is_update_product_type" value="0" />
<input type="checkbox" id="is_update_product_type_<?php
echo $post_type;
?>
" name="is_update_product_type" value="1" <?php
echo $post['is_update_product_type'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="is_update_product_type_<?php
echo $post_type;
?>
"><?php
_e('Product Type', 'wpai_woocommerce_addon_plugin');
?>
</label>
</div>
<div class="input">
<input type="hidden" name="attributes_list" value="0" />
<input type="hidden" name="is_update_attributes" value="0" />
<input type="checkbox" id="is_update_attributes_<?php
echo $post_type;
?>
" name="is_update_attributes" value="1" <?php
echo $post['is_update_attributes'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="is_update_attributes_<?php
echo $post_type;
?>
"><?php
_e('Attributes', 'wpai_woocommerce_addon_plugin');
?>
</label>
<div class="switcher-target-is_update_attributes_<?php
echo $post_type;
?>
" style="padding-left:17px;">
<div class="input">
<input type="radio" id="update_attributes_logic_full_update_<?php
echo $post_type;
?>
" name="update_attributes_logic" value="full_update" <?php
echo "full_update" == $post['update_attributes_logic'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="update_attributes_logic_full_update_<?php
echo $post_type;
?>
"><?php
_e('Update all Attributes', 'wpai_woocommerce_addon_plugin');
?>
</label>
</div>
<div class="input">
<input type="radio" id="update_attributes_logic_only_<?php
echo $post_type;
?>
" name="update_attributes_logic" value="only" <?php
echo "only" == $post['update_attributes_logic'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="update_attributes_logic_only_<?php
echo $post_type;
?>
"><?php
_e('Update only these Attributes, leave the rest alone', 'wpai_woocommerce_addon_plugin');
?>
</label>
<div class="switcher-target-update_attributes_logic_only_<?php
echo $post_type;
?>
pmxi_choosen" style="padding-left:17px;">
<span class="hidden choosen_values"><?php
if (!empty($all_existing_attributes)) {
//.........这里部分代码省略.........
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:101,代码来源:pmxi_reimport.php
示例6: _e
<div class="input">
<input type="hidden" name="taxonomies_list" value="0" />
<input type="hidden" name="is_update_categories" value="0" />
<input type="checkbox" id="is_update_categories" name="is_update_categories" value="1" class="switcher" <?php
echo $post['is_update_categories'] ? 'checked="checked"' : '';
?>
/>
<label for="is_update_categories"><?php
_e('Taxonomies (incl. Categories and Tags)', 'wp_all_import_plugin');
?>
</label>
<div class="switcher-target-is_update_categories" style="padding-left:17px;">
<?php
$existing_taxonomies = array();
$hide_taxonomies = class_exists('PMWI_Plugin') ? array('product_type') : array();
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($hide_taxonomies));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
if ("" == $ctx->labels->name or class_exists('PMWI_Plugin') and $post_type == "product" and strpos($ctx->name, "pa_") === 0) {
continue;
}
$existing_taxonomies[] = $ctx->name;
}
}
?>
<div class="input" style="margin-bottom:3px;">
<input type="radio" id="update_categories_logic_all_except" name="update_categories_logic" value="all_except" <?php
echo "all_except" == $post['update_categories_logic'] ? 'checked="checked"' : '';
?>
class="switcher"/>
<label for="update_categories_logic_all_except"><?php
开发者ID:Kilbourne,项目名称:restart,代码行数:31,代码来源:_reimport_options.php
示例7: __ver_4_transition_fix
public function __ver_4_transition_fix(&$options)
{
$options['wizard_type'] = $options['duplicate_matching'] == 'auto' ? 'new' : 'matching';
if ($options['download_images']) {
$options['download_images'] = 'yes';
$options['download_featured_image'] = $options['featured_image'];
$options['featured_image'] = '';
$options['download_featured_delim'] = $options['featured_delim'];
$options['featured_delim'] = '';
}
if ($options['set_image_meta_data']) {
$options['set_image_meta_title'] = 1;
$options['set_image_meta_caption'] = 1;
$options['set_image_meta_alt'] = 1;
$options['set_image_meta_description'] = 1;
}
if ("" == $options['custom_type']) {
$options['custom_type'] = $options['type'];
}
$exclude_taxonomies = class_exists('PMWI_Plugin') ? array('post_format', 'product_type') : array('post_format');
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($options['custom_type']), 'object'), array_flip($exclude_taxonomies));
$options['tax_logic'] = array();
$options['tax_assing'] = array();
$options['tax_multiple_xpath'] = array();
$options['tax_multiple_delim'] = array();
$options['tax_hierarchical_logic_entire'] = array();
$options['tax_hierarchical_logic_manual'] = array();
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
$options['tax_logic'][$ctx->name] = $ctx->hierarchical ? 'hierarchical' : 'multiple';
if ($ctx->name == 'category') {
$options['post_taxonomies']['category'] = $options['categories'];
} elseif ($ctx->name == 'post_tag') {
$options['tax_assing']['post_tag'] = 1;
$options['tax_multiple_xpath']['post_tag'] = $options['tags'];
$options['tax_multiple_delim']['post_tag'] = $options['tags_delim'];
}
if (!empty($options['post_taxonomies'][$ctx->name])) {
$taxonomies_hierarchy = json_decode($options['post_taxonomies'][$ctx->name], true);
$options['tax_assing'][$ctx->name] = !empty($taxonomies_hierarchy[0]['assign']) ? 1 : 0;
if ($options['tax_logic'][$ctx->name] == 'multiple') {
$options['tax_multiple_xpath'][$ctx->name] = !empty($taxonomies_hierarchy[0]['xpath']) ? $taxonomies_hierarchy[0]['xpath'] : '';
$options['tax_multiple_delim'][$ctx->name] = !empty($taxonomies_hierarchy[0]['delim']) ? $taxonomies_hierarchy[0]['delim'] : '';
} else {
$options['tax_hierarchical_logic_manual'][$ctx->name] = 1;
}
}
}
}
}
开发者ID:GolgoSoft,项目名称:KeenerWP,代码行数:50,代码来源:plugin.php
示例8: init_available_data
public function init_available_data()
{
global $wpdb;
$table_prefix = $wpdb->prefix;
// Prepare existing taxonomies
if ('specific' == $this->post['export_type'] and !self::$is_user_export) {
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array(self::$post_types[0]), 'object'), array_flip(array('post_format')));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $tx) {
if (strpos($tx->name, "pa_") !== 0) {
$this->_existing_taxonomies[] = $tx->name;
}
}
}
$post_type = self::$post_types[0];
$meta_keys = $wpdb->get_results("SELECT DISTINCT {$table_prefix}postmeta.meta_key FROM {$table_prefix}postmeta, {$table_prefix}posts WHERE {$table_prefix}postmeta.post_id = {$table_prefix}posts.ID AND {$table_prefix}posts.post_type = '{$post_type}' LIMIT 500");
if (!empty($meta_keys)) {
foreach ($meta_keys as $meta_key) {
$this->_existing_meta_keys[] = $meta_key->meta_key;
}
}
}
if ('advanced' == $this->post['export_type'] and !self::$is_user_export) {
$meta_keys = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$table_prefix}postmeta LIMIT 500");
if (!empty($meta_keys)) {
foreach ($meta_keys as $meta_key) {
$this->_existing_meta_keys[] = $meta_key->meta_key;
}
}
global $wp_taxonomies;
foreach ($wp_taxonomies as $key => $obj) {
if (in_array($obj->name, array('nav_menu'))) {
continue;
}
if (strpos($obj->name, "pa_") !== 0 and strlen($obj->name) > 3) {
$this->_existing_taxonomies[] = $obj->name;
}
}
}
// Prepare existing ACF groups & fields
$this->acf_export->init($this->_existing_meta_keys);
// Prepare existing WooCommerce data
$this->woo_export->init($this->_existing_meta_keys);
// Prepare existing WooCommerce Order data
$this->woo_order_export->init();
// Prepare existing Users data
$this->user_export->init($this->_existing_meta_keys);
return $this->get_available_data();
}
开发者ID:hikaram,项目名称:wee,代码行数:49,代码来源:XmlExportEngine.php
示例9: after_save_post
public function after_save_post($importData)
{
$postRecord = new PMXI_Post_Record();
$postRecord->clear();
// find corresponding article among previously imported
$postRecord->getBy(array('unique_key' => 'Variation ' . get_post_meta($importData['pid'], '_sku', true), 'import_id' => $this->import->id));
$pid = !$postRecord->isEmpty() ? $postRecord->post_id : false;
if ($pid) {
// Get all existing meta keys of parent product
$existing_meta_keys = array();
$table = _get_meta_table('post');
$post_meta_infos = $this->wpdb->get_results("SELECT meta_key, meta_value FROM {$table} WHERE post_id = " . $importData['pid']);
if (!empty($post_meta_infos) and !empty($this->import->options['custom_name'])) {
foreach ($post_meta_infos as $meta_info) {
if (in_array($meta_info->meta_key, $this->import->options['custom_name'])) {
$this->pushmeta($pid, $meta_info->meta_key, maybe_unserialize($meta_info->meta_value));
}
}
}
// save thumbnail
$post_thumbnail_id = get_post_thumbnail_id($importData['pid']);
if ($post_thumbnail_id) {
set_post_thumbnail($pid, $post_thumbnail_id);
}
if ($this->import->options['put_variation_image_to_gallery'] and $post_thumbnail_id) {
do_action('pmxi_gallery_image', $pid, $post_thumbnail_id, false);
}
if ($this->import->options['create_draft'] == 'yes' and $p->post_status == 'draft') {
$this->wpdb->update($this->wpdb->posts, array('post_status' => 'publish'), array('ID' => $pid));
}
}
$table = $this->wpdb->posts;
$p = $this->wpdb->get_row($this->wpdb->prepare("SELECT * FROM {$table} WHERE ID = %d;", $importData['pid']));
if ($p) {
$post_to_update_id = false;
if ($p->post_type == 'product_variation') {
if ($this->import->options['create_draft'] == 'yes' and $p->post_status == 'draft') {
$this->wpdb->update($this->wpdb->posts, array('post_status' => 'publish'), array('ID' => $importData['pid']));
}
$this->wpdb->update($this->wpdb->posts, array('post_excerpt' => '', 'post_name' => sanitize_title($p->post_title), 'guid' => ''), array('ID' => $importData['pid']));
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array('product'), 'object'), array_flip(array('post_format', 'product_type', 'product_shipping_class')));
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $ctx) {
if (strpos($ctx->name, "pa_") === 0) {
continue;
}
$this->associate_terms($importData['pid'], false, $ctx->name);
}
}
delete_post_meta($importData['pid'], '_v_product_manage_stock');
delete_post_meta($importData['pid'], '_v_stock');
delete_post_meta($importData['pid'], '_v_stock_status');
delete_post_meta($importData['pid'], '_v_variation_enabled');
delete_post_meta($importData['pid'], '_first_variation_attributes');
delete_post_meta($importData['pid'], '_v_shipping_class');
$post_to_update_id = $p->post_parent;
} else {
update_post_meta($importData['pid'], '_product_version', WC_VERSION);
$post_to_update_id = $importData['pid'];
// [associate linked products]
$wp_all_import_not_linked_products = get_option('wp_all_import_not_linked_products_' . $this->import->id);
if (!empty($wp_all_import_not_linked_products)) {
$post_to_update_sku = get_post_meta($post_to_update_id, '_sku', true);
foreach ($wp_all_import_not_linked_products as $product) {
if ($product['pid'] != $post_to_update_id && !empty($product['not_linked_products'])) {
if (in_array($post_to_update_sku, $product['not_linked_products']) or in_array((string) $post_to_update_id, $product['not_linked_products']) or in_array($p->post_title, $product['not_linked_products']) or in_array($p->post_name, $product['not_linked_products'])) {
$linked_products = get_post_meta($product['pid'], $product['type'], true);
if (empty($linked_products)) {
$linked_products = array();
}
if (!in_array($post_to_update_id, $linked_products)) {
$linked_products[] = $post_to_update_id;
$this->logger and call_user_func($this->logger, sprintf(__('Added to %s list of product ID %d.', 'wpai_woocommerce_addon_plugin'), $product['type'] == '_upsell_ids' ? 'Up-Sells' : 'Cross-Sells', $product['pid']));
update_post_meta($product['pid'], $product['type'], $linked_products);
}
}
}
}
}
// [\associate linked products]
}
// [update product gallery]
$tmp_gallery = explode(",", get_post_meta($post_to_update_id, '_product_image_gallery_tmp', true));
$gallery = explode(",", get_post_meta($post_to_update_id, '_product_image_gallery', true));
if (is_array($gallery)) {
$gallery = array_filter($gallery);
if (!empty($tmp_gallery)) {
$gallery = array_unique(array_merge($gallery, $tmp_gallery));
}
} elseif (!empty($tmp_gallery)) {
$gallery = $tmp_gallery;
}
update_post_meta($post_to_update_id, '_product_image_gallery', implode(",", $gallery));
// [\update product gallery]
wc_delete_product_transients($importData['pid']);
}
}
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:97,代码来源:XmlImportWooCommerceProduct.php
注:本文中的get_taxonomies_by_object_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论