Portfolio Url Slug

Home Forums Reykjavik Portfolio Url Slug

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21483

    austriker
    Participant

    Portfolio Url Slug

    Resolved

    Hey there! Have you noticed this support service is provided FREE of charge?
    If you like the speed and accuracy of resolutions, please consider supporting me with a small donation. Thank you

    Consider a donation →

    Hi there,

    Big fan of your theme! I’m using the portfolio from jetpack and want to change the url slug of portfolio. I tried to search the internet and found some code but it doesnt work when I add it to my child theme functions.php.

    here’s what I tried (also with my child theme name before “portfolio_permalink_slug”) :

    add_filter( 'portfolio_permalink_slug', 'custom_portfolio_slug');
    
    function custom_portfolio_slug() {
    	return 'showcase';
    }

    per this link : https://wordpress.org/support/topic/change-portfolio-slug-2/

    I was hoping you might be able to help / have maybe come across this before. Thanks!!

    • This topic was modified 3 weeks ago by  Oliver Juhas. Reason: Formatting code
    #21485

    Oliver Juhas
    Keymaster

    Hi austriker,

    Thank you, I’m glad you like the theme :)

    I’m sorry, but the solution you’ve found is not applicable for Jetpack plugin. Also, please understand that I can provide support for my products only and you should be better asking Jetpack support for help with this issue.

    Looking at Jetpack code I can’t really see any easy way of changing the Portfolio post type slug though. So, here is a solution using WordPress native functionality. Put this code into functions.php file of your child theme:

    function child_theme_portfolio_slug( $args, $post_type ){
    	if ( class_exists( 'Jetpack_Portfolio' ) && Jetpack_Portfolio::CUSTOM_POST_TYPE === $post_type ){
    		$args['rewrite']['slug'] = 'my-portfolio-slug';
    	}
    	return $args;
    }
    add_filter( 'register_post_type_args', 'child_theme_portfolio_slug', 10, 2 );

    Change the my-portfolio-slug to preferred value. Also, don’t forget to flush permalinks afterwards: simply navigate to Settings → Permalinks and press the “Save changes” button.

    Tip: I also found an article providing alternative code.

    Best regards,

    Oliver Juhas
    WebMan Design

    #21486

    austriker
    Participant

    Awesome! That totally worked! Thanks a ton!

    PS for anyone visiting in the future:
    I tried this link below but sadly it didnt work either:
    https://colorlib.com/wp/forums/topic/how-to-change-the-portfolio-permalink-slug/#post-58170

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.