How can we help?

If you are looking for support for our PokaTheme, this is the place!

Home Forums PokaTheme support More content to the page

  • This topic has 1 reply, 2 voices, and was last updated 1 year ago by admin.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14734
    fietspankrukvor
    Participant

    Hello,

    I’d like to redirect the /review CTP archive page to a page with content. I tried to paste the following code it worked for a day but now it’s redirecting me to the classic /review archive page with no chance to customize it. Can you please help me out?

    add_filter( ‘register_post_type_args’, ‘change_slug_affiliates_cpt’, 10, 2 );
    function change_slug_affiliates_cpt( $args, $post_type ) {

    if ( $post_type == ‘affiliates’) {
    $args[‘rewrite’][‘slug’] = ‘myslug’;
    $args[‘labels’][‘name’] = ‘myname’;
    $args[‘has_archive’] = true;
    }

    return $args;
    }

    #14751
    admin
    Keymaster

    Hi!

    With the snippet above you don’t disable the archive page of the CPT.
    You need to add the following:

    function change_slug_affiliates_cpt( $args, $post_type ) {
    
    if ( $post_type == 'affiliates') {
      $args['has_archive'] = false;
    }
    
    return $args;
    }
    add_filter( 'register_post_type_args', 'change_slug_affiliates_cpt', 10, 2 );
    

    Then you can create your own page using the slug of the previous archives.

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