Is it possible to use same slug?

Discussion in 'WordPress' started by Divvy, Jun 14, 2017.

  1. #1
    Hello guys,

    Can someone give me a little help here?

    I have a wordpress and I use this URL for my blog (custom):
    https://domain.com/blog
    Code (markup):
    And I use this URL for my blog articles:
    https://domain.com/news/title-here
    Code (markup):
    Is it possible to use the URL for articles with /blog/ instead of /news/ ?
    I mean, like this:
    https://domain.com/blog/title-here
    Code (markup):
    My functions.php code:

    
    /* #################### Register For Article ############### */   
        $labels2 = array(
            'name'               =>'Blogs',
            'singular_name'      =>'Site',
            'menu_name'          =>'Blogs',
            'name_admin_bar'     =>'Blogs',
            'add_new'            =>'Add New',
            'add_new_item'       =>'Add New Blog',
            'new_item'           =>'New Blog',
            'edit_item'          =>'Edit Blog',
            'view_item'          =>'View Blog',
            'all_items'          =>'All Blog',
            'search_items'       =>'Search Site',
            'parent_item_colon'  =>'Parent Site:',
            'not_found'          =>'No Articles found.',
            'not_found_in_trash' =>'No Articles found in Trash.'
        );
    
        $args2 = array(
            'labels'             => $labels2,
            'description'        =>'Description.',
            'public'             => true,
            'publicly_queryable' => true,
            'show_ui'            => true,
            'show_in_menu'       => true,
            'query_var'          => true,
            'rewrite'            => array( 'slug' => 'news' ),
            'capability_type'    => 'post',
            'has_archive'        => true,
            'hierarchical'       => false,
            'menu_position'      =>7,
            'supports'           => array( 'title','thumbnail','editor','excerpt')
        );
        register_post_type( 'blog',$args2);           
       
    /* End code of Articles */   
    
    PHP:
    Help...

    Thanks! :)
     
    Divvy, Jun 14, 2017 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,795
    Likes Received:
    4,531
    Best Answers:
    123
    Trophy Points:
    665
    #2
    It's been a while since I've dug through custom post types so I'm not going to look at your code

    however

    You can have your standard posts showing as /news/
    and then have a custom post type for articles showing as /blog/
    that's definitely what the custom post types are meant to enable.
     
    sarahk, Jun 14, 2017 IP
  3. Divvy

    Divvy Well-Known Member

    Messages:
    785
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Hello Sarah,

    Thank you for trying to helping me.
    But I use the standard posts for other thing, for reviews, and not articles.
     
    Divvy, Jun 15, 2017 IP