Portfolio Permalink URL Structure Different From Blog
In my website settings, under Permalinks, I have a custom URL structure set up: /blog/%postname%/
. This allows my single posts (blog articles) to be structured with /blog/
as the subdirectory for all my posts. Great, working as desired.
I have configured the Slug field in the Portfolio plugin (under Settings) to be ‘portfolio‘. When I click on an individual Portfolio Item, the slug for the item resolves to: /blog/portfolio/[portfolio-item]
I do not want to include ‘/blog/’ in my portfolio items URL, how do I remove this?
From searching around it appears modifying the functions.php of my child theme is needed, but I cannot figure out the code that will work. I've tried using "Muffin" specific variants of the code posted in these threads without any luck:
Comments
Hi,
"Blog" should not be included in the portfolio URL.
Are you sure that you created and assigned the Portfolio page correctly?
https://support.muffingroup.com/video-tutorials/how-to-set-up-the-blog-and-portfolio-pages/
Please attach a link to your website.
Thanks
My site is behind an under construction page.
To clarify, it is not the parent Portfolio page itself that has "blog" in the URL. It is all the posts within the portfolio:
Portfolio settings in betheme options
Main portfolio page
Portfolio Post
Blog Post
Please send us the WordPress dashboard access privately thru the contact form, which is on the right side at http://themeforest.net/user/muffingroup#contact, and we will check what might be the reason.
Notice!
Please attach a link to this forum discussion.
Sending incorrect or incomplete data will result in a longer response time.
Therefore, please make sure that the data you are sending are complete and correct.
Thanks
The thread, login page, username, and password has been sent using the form at http://themeforest.net/user/muffingroup#contact
Let me know if anything else is needed!
Sorry, but we didn't get any message from you yet.
Please check your mail inbox for our response. Look also inside the spam folder.
If you don't have any message from us, please send your login credentials again.
Be sure that you sent all of the required information mentioned in the previous message.
Thanks
I did not notice that you put the "blog" as a static text, which is why it is always added.
If you do not want it to be displayed there, you should remove it, or change it to some tag.
Best regards
If I remove "/blog" from the permalink structure, it also removes "/blog" for my blog posts.
How do I achieve the following structure?
You must edit the theme files responsible for the Portfolio to achieve that.
We do not provide help with such customization, but the following article might be helpful for you:
https://artisansweb.net/how-to-add-blog-to-the-wordpress-post-urls/
Best regards
For anyone wondering, I resolved this issue by adding the following code to my child themes funtion.php
/**
* Remove "blog" from url for the Portfolio
*/
add_filter( 'register_post_type_args', function( $args, $post_type )
{
if( 'portfolio' === $post_type && is_array( $args ) )
$args['rewrite']['with_front'] = false;
return $args;
}, 99, 2 );