Avada Forums Community Forum Add /blog/ URL only in post type post.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • honoluluman
    Post count: 2


    I am using Avada -Digital Agency and i noticed that i have a problem with my permalinks structure.
    When i set my structure like that unfortunatelly this structure applies also to my portfolio URLs.

    How can i add /blog/ in front of my single post URL’s but not also in my portfolio URL’s ?

    According to this tutorial the portfolio CPT should have ‘rewrite with front’ disabled.

    Is there some filter that could help? Does anyone have been facing the same problem?

    Thank you very much for your time.

    Post count: 2

    I just found myself trying to do this. I’ll write up my solution so that others can do it…

    First of all, you have to find which custom post types your theme has. You can do this using this handy plugin

    The results from using it on Avada are as follows.

    1. fusion_tb_layout
    2. fusion_tb_section
    3. fusion_form
    4. avada_portfolio
    5. avada_faq
    6. fusion_icons
    7. awb_off_canvas
    8. slide
    9. fusion_template
    10. fusion_element

    In your case honoluluman you want to target avada_portfolio.

    In your child avada theme folder, open up the functions.php file and paste this in

     * Remove "blog" from url for the Portfolio
    add_filter( 'register_post_type_args', function( $args, $post_type )
        if( 'avada_portfolio' === $post_type && is_array( $args ) )
                $args['rewrite']['with_front'] = false;
        return $args;
    }, 99, 2 );

    Save the file. You will need to flush your permalinks to see the result. To do this, copy your custom structure (just so you don’t lose it) change the permalinks to “Plain” and save, then change it back to your customer structure.

    I hope that helps!

    Post count: 2

    Thank you very much for your help Stevea,

    This code was working correct until the latest update that i did to theme and fusion-core plugin.
    After that it doesn’t work anymore.
    I have tried everything (many many times flusing permalinks from wp-admin/options-permalink.php)but it seems like register_post_type_args don’t work.

    Then i just tried to set the $arg even manually in fusion-core plugin code (/wp-content/plugins/fusion-core/includes/class-fusioncore-plugin.php) and still didn’t work.
    I can not understand what is going on?

    Any ideas would be appreciated.

    Post count: 2

    What versions are you running?

    I’m running the latest theme version 7.8.1 with the latest WordPress (6.0.1) and the latest Avada Core plugin (5.8.1) and it works fine for me.

    Did you make the change to the functions file for Avada Child Theme?
    Is the Child Theme active? (Rather than the main Avada theme)

    You shouldn’t have to edit any of the main theme or plugin files. When those get updated the files are overwritten and replaced meaning you’ll lose any edits.

    Child themes are a safe way to modify a WordPress theme without actually making any changes to the parent theme’s files. In order to apply the modifications the child theme has to be activated. The parent theme will still include any functionality that hasn’t been overwritten by the child theme.

    I hope that makes sense. If not, I suggest reading about WordPress child themes. The Avada child theme is included with your download.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.