• Home
  • About me
  • Gallery
  • WordPress
  • Life
  • Contact us

Laxman Prajapati

~ WordPress Blog

Laxman Prajapati

Daily Archives: April 18, 2014

Custome Post Type And Custom Taxonomy Type In WordPress

18 Friday Apr 2014

Posted by Laxman Prajapati in WordPress

≈ 6 Comments

Tags

Custome Post Type And Custom Taxonomy Type

 
/*  Custome Post Type */

add_action( 'init', 'wp_product' );
function wp_product() {
	register_post_type( 'wp_product',
		array(
			'labels' => array(
				'name' => __( 'WP Catalogue' ),
				'singular_name' => __( 'Product' ),
				'search_items' =>  __( 'Search Product' ),
				'parent_item' => __( 'Parent Product' ),
				'parent_item_colon' => __( 'Parent Product:' ),
				'edit_item' => __( 'Edit Product' ),
				'update_item' => __( 'Update Product' ),
				'add_new_item' => __( 'Add New Product' ),
				'new_item_name' => __( 'New Product Name' ),
				
			),
			'public' => true,
			'has_archive' => true,
			'rewrite' => array('slug' => 'products'),
                        'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments' ),
		)
	);
}

/*------------------------------------------------------------------------------------------------------*/

 /*  Custome Taxonomy Type */

function add_product_taxonomies() {

	register_taxonomy('p_category', 'wp_product', array(
		// Hierarchical taxonomy (like categories)
		'hierarchical' => true,
		// This array of options controls the labels displayed in the WordPress Admin UI
		'labels' => array(
			'name' => _x( 'Product Category', 'taxonomy general name' ),
			'singular_name' => _x( 'Category', 'taxonomy singular name' ),
			'search_items' =>  __( 'Search Categories' ),
			'all_items' => __( 'All Categories' ),
			'parent_item' => __( 'Parent Categories' ),
			'parent_item_colon' => __( 'Parent Categories:' ),
			'edit_item' => __( 'Edit Categories' ),
			'update_item' => __( 'Update Categories' ),
			'add_new_item' => __( 'Add New Categories' ),
			'new_item_name' => __( 'New Categories Name' ),
			'menu_name' => __( 'Categories' ),
		),

		// Control the slugs used for this taxonomy
		'rewrite' => array(
			'slug' => 'p_category', // This controls the base slug that will display before each term
			'with_front' => false, // Don't display the category base before "/locations/"
			'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
		),
	));
}
add_action( 'init', 'add_product_taxonomies', 0 ); 

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...
Follow Laxman Prajapati on WordPress.com

About Me

Laxman Prajapati

Laxman Prajapati

Have to lose something to gain something

View Full Profile →

Total Blog Hits

  • 29,249 Views

Fish

Calendar

April 2014
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  
« Mar   May »

Logo

wordpress-logo-stacked-rgb

Category

Animal Anniversary birthday Blog BuddyPress Family Flower Friends Goal Google Happiness Happy new year Health Independence Day Life Love Mind Fresh Natural PHP Positive Republic Day WordPress

Blogs I Follow

Success Life

“Success is not final, failure is not fatal: it is the courage to continue that counts.” ― Winston Churchill
“If at first you don't succeed, try, try again. Then quit. No use being a damn fool about it.” ― W. C. Fields
“Nearly all men can stand adversity, but if you want to test a man's character, give him power.” ― Abraham Lincoln
“Success is most often achieved by those who don't know that failure is inevitable.” ― Coco Chanel

Recent Posts

  • How to increase WordPress website speed without a plugin
  • How to install Twnety Twenty theme on WordPress Website?
  • How to download PDF file using WordPress codex
  • New Gallery Widget in WordPress 4.9
  • Template Hierarchy
  • WordPress Work Sheet
  • Merry Christmas
  • #SRK

Category

Animal Anniversary birthday Blog BuddyPress Family Flower Friends Goal Google Happiness Happy new year Health Independence Day Life Love Mind Fresh Natural PHP Positive Republic Day WordPress

Gallery

success
tree_success
succaess
success-secrets-1
15_5_orig
sucscess
success-1
success2
success

Blog at WordPress.com.

Tianu Gujarati Blog - Anurag Rathod

જેને કશું કામ કરવા ના હોય એ નવરો બેઠો બેઠો બ્લોગ લખે.

WordCamp Ahmedabad 2019 a.k.a 3.0

#WCAhmedabad

Hinal Sanghvi

Hinal Sanghvi

WordPress Educator Zac Gordon

A Blog for Tutorials, Free Videos, and Updates on Courses, Talks and Workshops

seenu625

love nature, and all things creative

Hello Beautiful Book Blog

beautiful nerdy bookish things

How Useful It Is

Trying to be Useful, one post at a time!

vlandaman.wordpress.com/

On Becoming Fearless

Dreaming, believing, learning then achieving

Dil Ki Kitaab ( दिल की किताब )

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Laxman Prajapati
    • Join 523 other followers
    • Already have a WordPress.com account? Log in now.
    • Laxman Prajapati
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    %d bloggers like this: