I've added the following code in functions.php of child theme:
// Custom rewrite URL (The first parameter is how you want the URL to be.)
add_action( 'init', function() {
add_rewrite_rule( '^courses/photography-ideas/?', 'index.php?portfolio=courses-photography-ideas', 'top' );
} );
For custom URL structure like that it requires custom coding, so I am giving you an idea how you can change the appearing URL of that item, so by adding:
Yes, I understand, much appreciated - the video - shows me where to go. I will have a play around tomorrow but will back up the site beforehand, thanks.
Hi, I'm looking to change the - after courses to a /
In edit, it won't accept. Using category/postname in permalinks custom just gives me a 404. Any thoughts? Thanks
Hi Darren,
So you are trying to make that URL:
https://creativecamera.online/courses-photography-ideas/
To:
https://creativecamera.online/courses/photography-ideas/
In this case you can only make with custom coding because WordPress doesn't allow adding forward slashes in permalinks.
Optionally, you can make all portfolio items with prefix /courses in Theme Options > Portfolio Settings > Portfolio Page > URL Rewrite Options:
(view large image)
But then all portfolio items will have /courses prefix. Will that work for you?
Hi, Yes convert to:
https://creativecamera.online/courses/photography-ideas/
"But then all portfolio items will have /courses prefix. Will that work for you?''
No, that won't work as some will need to be workshops or tutorials.
What's custom coding?
I've added the following code in functions.php of child theme:
So now you can access it:https://creativecamera.online/courses/photography-ideas/
Please note that if you change the slug of that portfolio item you have to replace it in index.php?portfolio=your-new-slug
Ok, but it's not changed on the site?
Also I will need to do the same for workshops and tutorials.
Can I just change the slug on the snippet area?
[EDIT]
The site is going live to clients now so looking to avoid page breaks for a day or so.
Hi, can you give me some clear steps either with a link to a video or page so I can make the changes for courses, tutorials and workshops/
thanks
Hi Darren,
For custom URL structure like that it requires custom coding, so I am giving you an idea how you can change the appearing URL of that item, so by adding:
In the menu will look like:
https://d.pr/v/TLNtZZ
So based on this pattern you can replace for other pages.
Note that this is custom code, since we do not provide custom work in support I gave you this time to help you out of support scope.
Yes, I understand, much appreciated - the video - shows me where to go. I will have a play around tomorrow but will back up the site beforehand, thanks.
Hi, the URL are not for the top level menu, but instead for the internal pages. Should I remove the 'add filter set-up nav menu item'?