Community Forums › Forums › Archived Forums › General Discussion › CPT's + permalinks
Tagged: CPT URL, permalinks, rewrite slug
- This topic has 6 replies, 2 voices, and was last updated 7 years, 8 months ago by design_agency.
-
AuthorPosts
-
July 12, 2016 at 11:02 am #189317design_agencyMember
hiya– trying to sort out an issue i've bumped into with my permalinks.
i have a CPT called 'public-scholars' where i have a catalog of talks and speakers and is located here:
http://dev3.design-agency.org/our-work/programs/public-scholar-catalog/when clicking into a post, the url becomes something like this: http://dev3.design-agency.org/scholar-catalog/food-for-thought/
where you lose the url breadcrumbs and contextual connection to the rest of the site. is there a way i can add in the 'our-work/programs/' to the url of these specific posts?
site password is: hope
many thanks in advance
http://dev3.design-agency.org/our-work/programs/public-scholar-catalog/July 12, 2016 at 11:32 am #189323Brad DaltonParticipantYou can customize the CPT slug.
'rewrite' => array( 'slug' => 'your-slug', 'with_front' => false ),
Executive Pro includes the full CPT code which includes the rewrite arg for register_taxonomy
rewrite (boolean/array) (optional) Set to false to prevent automatic URL rewriting a.k.a. "pretty permalinks". Pass an $args array to override default URL settings for permalinks as outlined below: Default: true 'slug' - Used as pretty permalink text (i.e. /tag/) - defaults to $taxonomy (taxonomy's name slug) 'with_front' - allowing permalinks to be prepended with front base - defaults to true 'hierarchical' - true or false allow hierarchical urls (implemented in Version 3.1) - defaults to false 'ep_mask' - (Required for pretty permalinks) Assign an endpoint mask for this taxonomy - defaults to EP_NONE. If you do not specify the EP_MASK, pretty permalinks will not work. For more info see this Make WordPress Plugins summary of endpoints. Note: You may need to flush the rewrite rules after changing this. You can do it manually by going to the Permalink Settings page and re-saving the rules -- you don't need to change them -- or by calling $wp_rewrite->flush_rules(). You should only flush the rules once after the taxonomy has been created, not every time the plugin/theme loads.
July 13, 2016 at 9:13 am #189399design_agencyMemberthanks for sending this along @braddalton
i imagine this goes into my functions.php file but i think it also needs to be wrapped in a function, yes? at best im a noob with php and what i've tried so far has crashed my local site. any nods in the right direction with how to properly insert this bit of code?
July 13, 2016 at 12:33 pm #189408Brad DaltonParticipantThis shows you how to edit the code which creates your CPT. Its as simple as that. If you're using a plugin to generate the CPT then you need to contact the plugin Dev. Otherwise, you can create the CPT using code from the Executive Pro themes functions file and change all instances of portfolio to the name of your CPT. Thats how i would do it.
July 14, 2016 at 1:53 pm #189491design_agencyMemberi did some more reading and that makes perfect sense, thanks for the follow up.
i did use wp-types to create the CPT and figured out how to get the urls to display correctly, but those url's aren't being reflected in the breadcrumbs. i reached out to the wp-types support team and they say it's a genesis problem: "As I can see "Breadcrumbs" set using genesis theme settings and may require studying what code genesis used to display breadcrumbs and unfortunately that is totally beyond the scope of our support policy."
so, im in a bit of a pickle in that the slugs are displaying correctly, but the breadcrumbs aren't.
any advice on what to do next?
July 14, 2016 at 2:12 pm #189493Brad DaltonParticipantJuly 14, 2016 at 3:44 pm #189503design_agencyMemberamazing. thank you!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.