Inventory_Presser_Plugin::create_custom_post_type()

create_custom_post_type


Description Description

Registers the inventory_vehicle post type that holds vehicles.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: inventory-presser.php

		if( empty( $hash ) )
		{
			return $url;
		}

		return $url . '?' . $hash;
	}

	/**
	 * change_term_links
	 * 
	 * Change links to terms in our taxonomies to include /inventory before 
	 * /tax/term.
	 *
	 * @param  string $termlink
	 * @param  object $term An instance of the WP_Term class
	 * @return string A modified term link that has our post type slug prepended.
	 */
	function change_term_links( $termlink, $term )
	{
		$taxonomy = get_taxonomy( $term->taxonomy );

		if( ! in_array( INVP::POST_TYPE, $taxonomy->object_type ) )
		{
			return $termlink;
		}

		$post_type = get_post_type_object( INVP::POST_TYPE );
		$termlink = $post_type->rewrite['slug'] . $termlink;

		return $termlink;
	}
	
	/**
	 * create_POST_TYPE
	 *
	 * Registers the inventory_vehicle post type that holds vehicles.
	 * 
	 * @return void
	 */
	static function create_post_type()
	{
		//creates a custom post type that will be used by this plugin
		register_post_type(
			INVP::POST_TYPE,
			apply_filters(