The code in this download folder enables you to remove the slug from the permalinks for single custom post types and taxonomy term archive pages.
In this case, the default permalink for single posts of a custom post type,before adding the code is
And the taxonomy term permalink is
After the code is added, the cpt-name can be removed and taxonomy type slug can be modified producing a permalink like this for the single post :
And a permalink like this for the taxonomy term
Also included in this download folder is code for :
- Creating your custom post
- Creating your taxonomy terms using the interface added via code without adding more code for each new term
- A single template for customizing/modifying single CPT’s
- A taxonomy template for customizing/modifying your taxonomy term archive pages for each term
Shows the admin interface for creating single custom post types AND custom taxonomy terms for your CPT.
Shows the CPT slug removed from the single post and the taxonomy slug modified for the taxonomy term archive page.
Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis child theme and non Genesis themes.
There’s 2 steps :
- # Copy & paste the PHP code ( Without the opening PHP tag ) from the functions.php file to the end of your child themes functions file
- # Upload the files named single-industry & taxonomy-industry-type.php to your child theme folder:
Make sure you resave your permalinks after installing the code. Go to Dashboard > Settings > permalinks and click Save.
Note : To change the name of your custom post type and taxonomy, use a code editor application like BB Edit for Mac or Notepad ++ to search & replace all instances of industry with the name of your CPT.Subscribe for new Tutorials