Răsfoiți Sursa

added slug rewrite for easier archives

eddiemachado 13 ani în urmă
părinte
comite
668eccdbf3
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      library/custom-post-type.php

+ 2 - 1
library/custom-post-type.php

@@ -42,7 +42,8 @@ function custom_post_example() {
 			'query_var' => true,
 			'menu_position' => 8, /* this is what order you want it to appear in on the left hand side menu */ 
 			'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png', /* the icon for the custom post type menu */
-			'rewrite' => true,
+			'rewrite'	=> array( 'slug' => 'custom_type', 'with_front' => false ), /* you can specify it's url slug */
+			'has_archive' => 'custom_type', /* you can rename the slug here */
 			'capability_type' => 'post',
 			'hierarchical' => false,
 			/* the next one is important, it tells what's enabled in the post editor */