Skip to main content
added 31 characters in body
Source Link
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147
//Place code in function.php 
add_action('init', 'my_new_default_post_type', 1); 
function my_new_default_post_type() 
{ 
register_post_type('post', 
array(
// 'labels' => $labels, 
'public' => true, 
//'show_in_admin_bar' => true,
'_builtin' => false, 
'_edit_link' => 'post.php?post=%d', 
'capability_type' => 'post', 
'map_meta_cap' => true, 
'hierarchical' => false, 
'rewrite' => array('slug' => 'resources/blog'), // Add your slug here 
'query_var' => false, 
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
)); 
/* If you add above code in function.php, Your blog pagination is stopped to working, You need to add rewrite rule using "Debug This" Plugin under Query >> Rewrite Section & modify your rewrite_rule. */ 
add_rewrite_rule('(.?.+?)/page/?([0-9]{1,})/?$', 'index.php?pagename=resources/blog&paged=$matches[1]', 'top'); }
//Place code in function.php 
add_action('init', 'my_new_default_post_type', 1); 
function my_new_default_post_type() 
{ 
    register_post_type('post', array(
        // 'labels' => $labels, 
        'public' => true, 
        //'show_in_admin_bar' => true,
        '_builtin' => false, 
        '_edit_link' => 'post.php?post=%d', 
        'capability_type' => 'post', 
        'map_meta_cap' => true, 
        'hierarchical' => false, 
        'rewrite' => array('slug' => 'resources/blog'), // Add your slug here 
        'query_var' => false, 
        'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
    )); 
    /* If you add above code in function.php, Your blog pagination is stopped to working, You need to add rewrite rule using "Debug This" Plugin under Query >> Rewrite Section & modify your rewrite_rule. */ 
    add_rewrite_rule('(.?.+?)/page/?([0-9]{1,})/?$', 'index.php?pagename=resources/blog&paged=$matches[1]', 'top');
}

//Place code in function.php 
add_action('init', 'my_new_default_post_type', 1); 
function my_new_default_post_type() 
{ 
register_post_type('post', 
array(
// 'labels' => $labels, 
'public' => true, 
//'show_in_admin_bar' => true,
'_builtin' => false, 
'_edit_link' => 'post.php?post=%d', 
'capability_type' => 'post', 
'map_meta_cap' => true, 
'hierarchical' => false, 
'rewrite' => array('slug' => 'resources/blog'), // Add your slug here 
'query_var' => false, 
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
)); 
/* If you add above code in function.php, Your blog pagination is stopped to working, You need to add rewrite rule using "Debug This" Plugin under Query >> Rewrite Section & modify your rewrite_rule. */ 
add_rewrite_rule('(.?.+?)/page/?([0-9]{1,})/?$', 'index.php?pagename=resources/blog&paged=$matches[1]', 'top'); }
//Place code in function.php 
add_action('init', 'my_new_default_post_type', 1); 
function my_new_default_post_type() 
{ 
    register_post_type('post', array(
        // 'labels' => $labels, 
        'public' => true, 
        //'show_in_admin_bar' => true,
        '_builtin' => false, 
        '_edit_link' => 'post.php?post=%d', 
        'capability_type' => 'post', 
        'map_meta_cap' => true, 
        'hierarchical' => false, 
        'rewrite' => array('slug' => 'resources/blog'), // Add your slug here 
        'query_var' => false, 
        'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
    )); 
    /* If you add above code in function.php, Your blog pagination is stopped to working, You need to add rewrite rule using "Debug This" Plugin under Query >> Rewrite Section & modify your rewrite_rule. */ 
    add_rewrite_rule('(.?.+?)/page/?([0-9]{1,})/?$', 'index.php?pagename=resources/blog&paged=$matches[1]', 'top');
}

added 212 characters in body
Source Link

add_action( 'init', 'my_new_default_post_type', 1 ); function my_new_default_post_type() {

register_post_type( 'post', array(
  //Place code 'labels'in =>function.php array(
        'name_admin_bar' => _xadd_action( 'Post''init', 'add new on admin bar''my_new_default_post_type', 1),
; 
function my_new_default_post_type() 
{ )
register_post_type('post', 
array(
// 'labels' => $labels,  
'public'  => true,
  
//'show_in_admin_bar' => true,
'_builtin' => false, 
    '_edit_link' => 'post.php?post=%d', 
    'capability_type' => 'post',
     
'map_meta_cap' => falsetrue,
     
'hierarchical' => truefalse,
     
'rewrite' => array( 'slug' => 'resources/blog' ), // You can addAdd your slug here
     
'query_var' => truefalse,
     
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
)); 
/* If you add above code in function.php, Your blog pagination is stopped to working, You need to add rewrite rule using "Debug This" Plugin under Query >> Rewrite Section & modify your rewrite_rule. */ 
add_rewrite_rule('(.?.+?)/page/?([0-9]{1,})/?$', 'index.php?pagename=resources/blog&paged=$matches[1]', 'top'); }

}

add_action( 'init', 'my_new_default_post_type', 1 ); function my_new_default_post_type() {

register_post_type( 'post', array(
    'labels' => array(
        'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
    ),
    'public'  => true,
    '_builtin' => false, 
    '_edit_link' => 'post.php?post=%d', 
    'capability_type' => 'post',
    'map_meta_cap' => false,
    'hierarchical' => true,
    'rewrite' => array( 'slug' => 'resources/blog' ), // You can add your slug here
    'query_var' => true,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
) );

}

//Place code in function.php 
add_action('init', 'my_new_default_post_type', 1); 
function my_new_default_post_type() 
{ 
register_post_type('post', 
array(
// 'labels' => $labels,  
'public' => true, 
//'show_in_admin_bar' => true,
'_builtin' => false, 
'_edit_link' => 'post.php?post=%d', 
'capability_type' => 'post',  
'map_meta_cap' => true,  
'hierarchical' => false,  
'rewrite' => array('slug' => 'resources/blog'), // Add your slug here  
'query_var' => false,  
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
)); 
/* If you add above code in function.php, Your blog pagination is stopped to working, You need to add rewrite rule using "Debug This" Plugin under Query >> Rewrite Section & modify your rewrite_rule. */ 
add_rewrite_rule('(.?.+?)/page/?([0-9]{1,})/?$', 'index.php?pagename=resources/blog&paged=$matches[1]', 'top'); }
Source Link

add_action( 'init', 'my_new_default_post_type', 1 ); function my_new_default_post_type() {

register_post_type( 'post', array(
    'labels' => array(
        'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
    ),
    'public'  => true,
    '_builtin' => false, 
    '_edit_link' => 'post.php?post=%d', 
    'capability_type' => 'post',
    'map_meta_cap' => false,
    'hierarchical' => true,
    'rewrite' => array( 'slug' => 'resources/blog' ), // You can add your slug here
    'query_var' => true,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
) );

}