View difference between Paste ID: 3zbkKMJ8 and sD3d3xfy
SHOW: | | - or go back to the newest paste.
1
// can someone please evaluate the code here to understand why "product" and "portfolio" not behave the same on the URLs?
2
// after Testing and ReTesting again, i understand that product doesn't work for singluar "single.php" or "single-product.php"
3
// meaning "domain.com/product/" and "domain.com/product/post/" take use of archive-product.php
4
// but if i rename archive-product.php to archive-products.php the url "/product/" does use the archive.php but..
5
// "/product/post/" show warning of " failed to open stream: No such file or directory"
6
7
$labels = array(
8
		'name' => _x('Products', 'post type general name'),
9
		'singular_name' => _x('Product', 'post type singular name'),
10
		'add_new' => _x('Add New', 'book'),
11
		'add_new_item' => __('Add New Product'),
12
		'edit_item' => __('Edit Product'),
13
		'new_item' => __('New Product'),
14
		'all_items' => __('All Products'),
15
		'view_item' => __('View Product'),
16
		'search_items' => __('Search Products'),
17
		'not_found' => __('No products found'),
18
		'not_found_in_trash' => __('No products found in the Trash'),
19
		'parent_item_colon' => '',
20
		'menu_name' => 'Products'
21
	);
22
	$args = array(
23
		'labels' => $labels,
24
		'description' => 'Holds our products and product specific data',
25
		'public' => true,
26
		'menu_position' => 5,
27
		//'hierarchical' => true,
28
		'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'comments'),
29
		'rewrite' => array('slug' => 'product'),
30
		'has_archive' => true
31
	);
32
	register_post_type('product', $args);
33
34
$labels = array(
35
		'name' => _x('My Portfolio', 'post type general name'),
36
		'singular_name' => _x('Portfolio Item', 'post type singular name'),
37
		'add_new' => _x('Add New', 'portfolio item'),
38
		'add_new_item' => __('Add New Portfolio Item'),
39
		'edit_item' => __('Edit Portfolio Item'),
40
		'new_item' => __('New Portfolio Item'),
41
		'view_item' => __('View Portfolio Item'),
42
		'search_items' => __('Search Portfolio'),
43
		'not_found' =>  __('Nothing found'),
44
		'not_found_in_trash' => __('Nothing found in Trash'),
45
		'parent_item_colon' => ''
46
	);
47
 
48
	$args = array(
49
		'labels' => $labels,
50
		'public' => true,
51
		'publicly_queryable' => true,
52
		'show_ui' => true,
53
		'query_var' => true,
54
		'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
55
		'has_archive' => true,
56
		'rewrite' => true,
57
		'capability_type' => 'post',
58
		'hierarchical' => false,
59
		'menu_position' => null,
60
		'supports' => array('title','editor','thumbnail')
61
	);
62
	add_theme_support('post-thumbnails');
63
	add_image_size('single-post-thumbnail', 400, 9999);
64
	register_post_type('portfolio', $args);
65
66
	register_taxonomy(
67
		"Skills",
68
		array("portfolio"),
69
		array(
70
			"hierarchical" => true,
71
			"label" => "Skills",
72
			"singular_label" => "Skill",
73
			"rewrite" => array('slug' => 'portfolio')
74
		)
75
	);