Changing Portfolio Slug for Your Portfolio Post Type in Jupiter X

When working with Jupiter X, you may want to personalize your website by using a custom slug for your portfolio items. By default, portfolio post types have the URL structure:

http://yourdomain.com/portfolio/post-name

However, if you wish the main portfolio page to also be named 'portfolio,' you'll encounter an issue since the theme already uses 'portfolio' as a slug for single portfolio items. This can lead to an error when trying to edit the page with Elementor. To resolve this, here are the steps you can follow to either change the default slug for portfolio post types or create a custom slug for your page.

Changing the Default Portfolio Slug

Before starting, please ensure you have a child theme installed and activated. This prevents future updates from overwriting your customizations.

  1. Access your WordPress dashboard and navigate to Appearance > Theme File Editor.
    • Alternatively, you can connect to your website via FTP and browse to wp-content/themes/jupiterx-child to edit the functions.php  file directly.
  2. In the Theme File Editor, locate the functions.php  file for your child theme.
  3. Carefully insert the following code at the bottom of your functions.php  file:
add_filter( 'register_post_type_args', 'change_portfolio_slug', 10, 2 );
function change_portfolio_slug( $args, $post_type ) {
    if ( 'portfolio' === $post_type ) {
        $args['rewrite']['slug'] = 'projects'; // You can replace 'projects' with any slug you prefer
    }
    return $args;
}
  1. After adding the code, go to Dashboard > Settings > Permalinks and simply click 'Save Changes' without making any adjustments. This step is crucial as it updates the permalink structure, ensuring your changes are applied correctly.

Creating a Custom Page Slug

If you prefer not changing the portfolio post type slug, you can opt for a custom slug for your page:

  • Create a new page and name it 'Portfolio' or any title you choose.
  • Change the slug of the page from 'portfolio' to something unique like 'my-portfolio' or 'gallery'.
  • Use Elementor to design your page, adding portfolio widgets and other content as desired.

By following either of the methods described above, you can customize the portfolio slug to fit your needs and maintain a cohesive structure within your website.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.