Okay
  Public Ticket #2644444
Change artist slug
Closed

Comments

  • Thierry started the conversation

    Hello, 

    I start building a site for a theater company.  This will have in the menu two sections : Shows and Workshop

    For this , I would like to use the "artist" CPT for shows  ( linked with the event - it is perfect) . The workshop will have the same structure. So I will like to duplicate the "artist" category. ( duplicate CPT) 

    I read articles about copying the CPT  and metabox in the child theme for the functions.php. When I deepdive into that, I won't find the CPT "artist"  in the function.

    How can I do that? ( even in the main steps, so I can learn by myself) 

    Thanks for your help ! 


  •  1,104
    Max replied

    Hi,

    im not familiar with duplicating cpt but our artist custom post type is called "artist". see screenshot https://d.pr/i/buQkPr

    Thanks,


    Max from the Sonaar.io Crew

  • Thierry replied

    Dear Max


    Thanks for your answer. I Check and I will keep it in once ( under creation) . 

    How is is possible to change the URL  to have create "creation" instead of "artist" in the URL.

    I think that is something I have to change in a php file. Do you know which one ? 

    Best regards

  •  1,104
    Max replied

    You can add this in your function.php of your child theme

    function change_post_types_slug( $args, $post_type ) {
    /* rename slug artist for animator */   
       if ( 'artist' === $post_type ) {
          $args['rewrite']['slug'] = 'animator';
       }
    return $args;
    }
    add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );


    Thanks,


    Max from the Sonaar.io Crew

  • Thierry replied

    Dear Max, 


    It works perfectly ! 

    thanks ! 

  •  1,104
    Max replied

    You are welcome

    Thanks,


    Max from the Sonaar.io Crew

  • Thierry replied

    Dear Max, 


    I confirmed maybe too early - In the back office, the change has been made ( the permanent link has changed but in the front office, I have a "page not found" page.... ( even in incognito mode).

    When I change manually with artist, it works :

    http://ulzrtbm.cluster030.hosting.ovh.net/artist/raymayor/

    MoreOver, I had a new elementor error - https://elementor.com/help/the-content-area-was-not-found-error/?utm_source=editor-panel&utm_medium=wp-dash&utm_campaign=learn when I load the page in the back office. 

    This is due to the change ( because When I remove it - elementor and Url work fine. 

    Do you know why? 

  •  1,104
    Max replied

    resave permalinks in wp-admin > settings > permalinks and hit save.


    Thanks,


    Max from the Sonaar.io Crew

  • Thierry replied

    Thanks Max, 


    It works ! 

  • Nick replied

    I just want to thank everyone in this thread for helping me correct an issue I requested a Dev to look at. In my limited dev knowledge I was able to correct it myself just after browsing teh community support. Ultimately saving me money. 

    Thank you. 

  • Nick replied

    To add. I'm looking at how I can perhaps change 'next artist' at the bottom of page. to update as per the post-type

  •  1,104
    Max replied

    Hello Nick, 

    You can change the theme's strings by going to WP-Admin > Theme Options > Translation. See screenshot: https://d.pr/i/YLeYcW

    Thanks,


    Max from the Sonaar.io Crew