/** * Validates archive multiple settings * * @param array $new_value * @param array $old_value * @return array */ function archive_multiple_settings_validation($new_value) { $product_slug = get_product_slug(); if ($new_value['category_archive_url'] == $product_slug) { $new_value['category_archive_url'] = $new_value['category_archive_url'] . '-1'; } return $new_value; }
function create_product() { global $wp_version; $enable_product_listing = get_option('enable_product_listing', 1); $slug = get_product_slug(); if ($enable_product_listing == 1 && get_integration_type() != 'simple') { $product_listing_t = $slug; } else { $product_listing_t = false; } $names = get_catalog_names(); $query_var = get_product_query_var(); if ($wp_version < 3.8) { $reg_settings = array('labels' => array('name' => $names['plural'], 'singular_name' => $names['singular'], 'add_new' => sprintf(__('Add New %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'add_new_item' => sprintf(__('Add New %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'edit_item' => sprintf(__('Edit %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'new_item' => sprintf(__('Add New %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'view_item' => sprintf(__('View %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'search_items' => sprintf(__('Search %s', 'al-ecommerce-product-catalog'), ucfirst($names['plural'])), 'not_found' => sprintf(__('No %s found', 'al-ecommerce-product-catalog'), $names['plural']), 'not_found_in_trash' => sprintf(__('No %s found in trash', 'al-ecommerce-product-catalog'), $names['plural'])), 'public' => true, 'has_archive' => $product_listing_t, 'rewrite' => array('slug' => apply_filters('product_slug_value_register', $slug), 'with_front' => false), 'query_var' => $query_var, 'supports' => array('title', 'thumbnail'), 'register_meta_box_cb' => 'add_product_metaboxes', 'taxonomies' => array('al_product_cat'), 'menu_icon' => plugins_url() . '/ecommerce-product-catalog/img/product.png', 'capability_type' => 'product', 'capabilities' => array('publish_posts' => 'publish_products', 'edit_posts' => 'edit_products', 'edit_others_posts' => 'edit_others_products', 'edit_published_posts' => 'edit_published_products', 'edit_private_posts' => 'edit_private_products', 'delete_posts' => 'delete_products', 'delete_others_posts' => 'delete_others_products', 'delete_private_posts' => 'delete_private_products', 'delete_published_posts' => 'delete_published_products', 'read_private_posts' => 'read_private_products', 'edit_post' => 'edit_product', 'delete_post' => 'delete_product', 'read_post' => 'read_product'), 'exclude_from_search' => false); } else { $reg_settings = array('labels' => array('name' => $names['plural'], 'singular_name' => $names['singular'], 'add_new' => sprintf(__('Add New %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'add_new_item' => sprintf(__('Add New %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'edit_item' => sprintf(__('Edit %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'new_item' => sprintf(__('Add New %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'view_item' => sprintf(__('View %s', 'al-ecommerce-product-catalog'), ucfirst($names['singular'])), 'search_items' => sprintf(__('Search %s', 'al-ecommerce-product-catalog'), ucfirst($names['plural'])), 'not_found' => sprintf(__('No %s found', 'al-ecommerce-product-catalog'), $names['plural']), 'not_found_in_trash' => sprintf(__('No %s found in trash', 'al-ecommerce-product-catalog'), $names['plural'])), 'public' => true, 'has_archive' => $product_listing_t, 'rewrite' => array('slug' => apply_filters('product_slug_value_register', $slug), 'with_front' => false), 'query_var' => $query_var, 'supports' => array('title', 'thumbnail'), 'register_meta_box_cb' => 'add_product_metaboxes', 'taxonomies' => array('al_product-cat'), 'capability_type' => 'product', 'capabilities' => array('publish_posts' => 'publish_products', 'edit_posts' => 'edit_products', 'edit_others_posts' => 'edit_others_products', 'edit_published_posts' => 'edit_published_products', 'edit_private_posts' => 'edit_private_products', 'delete_posts' => 'delete_products', 'delete_others_posts' => 'delete_others_products', 'delete_private_posts' => 'delete_private_products', 'delete_published_posts' => 'delete_published_products', 'read_private_posts' => 'read_private_products', 'edit_post' => 'edit_product', 'delete_post' => 'delete_product', 'read_post' => 'read_product'), 'exclude_from_search' => false); } register_post_type('al_product', $reg_settings); }