Title: Is this code right?
Last modified: August 21, 2016

---

# Is this code right?

 *  Resolved [nebuloushomosapien](https://wordpress.org/support/users/nebuloushomosapien/)
 * (@nebuloushomosapien)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/)
 *     ```
       <?php
   
       /* POST TYPE */
   
       add_action('init','create_product_post_type');
       function create_product_post_type() {
       	// Labels
       	$labels = array(
       		'name' => __('Products','framework'),
       		'singular_name' => __('Product','framework'),
       		'add_new' => __('Add new','framework'),
       		'add_new_item' => __('Add new product','framework'),
       		'edit_item' => __('Edit','framework'),
       		'new_item' => __('New product','framework'),
       		'view_item' => __('View product','framework'),
       		'search_items' => __('Search product','framework'),
       		'not_found' =>  __('No product found','framework'),
       		'not_found_in_trash' => __('No product found in trash','framework'),
       		'parent_item_colon' => '',
       		'menu_name' => __('Products','framework')
       	);
   
       	$short_url = (get_option('tz_products_short_url') != '') ? get_option('tz_products_short_url') : 0;
       	$slug_first_part = ((get_option('tz_custom_products_slug') != '') ? get_option('tz_custom_products_slug') : 'product');
       	if($short_url == 1) {
       		$slug = $slug_first_part;
       	} else {
       		$slug = $slug_first_part."/%product_category%/%product_brand%";
       	}
       ```
   
 * Could this be a reason for having a vanilla ice creams URL on my site as
 * [http://www.mysite.com/product/vanilla-ice-cream](http://www.mysite.com/product/vanilla-ice-cream)
 * when I desperately want it to be
 * [http://www.mysite.com/vanilla-ice-cream](http://www.mysite.com/vanilla-ice-cream)
 * ?? if yes what needs to be changed??

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143544)
 * > ‘name’ => __(‘Products’,’framework’),
 * The reson “product” shows up in the url is that that’s the name of the CPT you
   have assinged.
 *  Thread Starter [nebuloushomosapien](https://wordpress.org/support/users/nebuloushomosapien/)
 * (@nebuloushomosapien)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143561)
 * soo if I put it like
 * ‘name’=> __(‘framework’),
 * it would be fine?
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143591)
 * Please try reviewing:
 * [http://codex.wordpress.org/Post_Types#Custom_Post_Types](http://codex.wordpress.org/Post_Types#Custom_Post_Types)
 * [http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress](http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress)
 * [http://web-profile.com.ua/wordpress/docs/custom-post-types/](http://web-profile.com.ua/wordpress/docs/custom-post-types/)
 * [http://yoast.com/custom-post-type-snippets/](http://yoast.com/custom-post-type-snippets/)
 * [http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page](http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page)
 *  Thread Starter [nebuloushomosapien](https://wordpress.org/support/users/nebuloushomosapien/)
 * (@nebuloushomosapien)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143616)
 * It’s ok.. what I used 2 plugins to sort everything out.. THANK YOU SOO MUCH TARA!!
   🙂
 *  Thread Starter [nebuloushomosapien](https://wordpress.org/support/users/nebuloushomosapien/)
 * (@nebuloushomosapien)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143617)
 * It’s ok.. what I used 2 plugins to sort everything out.. THANK YOU SOO MUCH TARA!!
   🙂
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143620)
 * Glad you got it sorted 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Is this code right?’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [permalink](https://wordpress.org/support/topic-tag/permalink/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/is-this-code-right/#post-4143620)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
