Php 在只能添加自定义帖子的WordPress中添加新用户卷
我已经购买了这个主题,并希望在wordpress中添加新的用户名单,以便访问者可以注册到该网站并添加他们自己的房产 我尝试手动编写代码,但意识到这需要大量工作,我尝试使用Justin Tadlock()的members插件 我的问题是,我只能查看和编辑所有帖子,但不能编辑,这样访问者只能访问名为ESTATES的自定义帖子类型 下面是functions.php中的代码(我做了很多尝试,如果有人能看到并清除代码,我将非常感激):Php 在只能添加自定义帖子的WordPress中添加新用户卷,php,wordpress,custom-post-type,Php,Wordpress,Custom Post Type,我已经购买了这个主题,并希望在wordpress中添加新的用户名单,以便访问者可以注册到该网站并添加他们自己的房产 我尝试手动编写代码,但意识到这需要大量工作,我尝试使用Justin Tadlock()的members插件 我的问题是,我只能查看和编辑所有帖子,但不能编辑,这样访问者只能访问名为ESTATES的自定义帖子类型 下面是functions.php中的代码(我做了很多尝试,如果有人能看到并清除代码,我将非常感激): 你可以试试这个插件,它可以做你需要的一切 add_action('i
你可以试试这个插件,它可以做你需要的一切
add_action('init', 'wptuts_getrole');
function wptuts_getrole() {
$role = get_role('seller');
echo '<pre>';
var_dump($role);
echo '</pre>';
}
add_action( 'init', 'ct_add_role' );
function ct_add_role() {
$role = get_role( 'seller' );
$role->remove_cap('edit_posts');
$role->add_cap('read');
$role->add_cap('manage_options');
$role->add_cap('publish_posts');
$role->add_cap('add_estates');
$role->add_cap('edit_estate');
/*add_role('seller', 'Seller', array(
'read' => true,
'add_posts'=> false,
'publish_posts' => false,
'edit_posts' => false,
'delete_posts' => false,
'add_estate'=> false,
'manage_options'=>false,
));*/
//}
/**
* #####################################
* Actions
* #####################################
*/
static function register() {
$args = array(
'labels' => array(
'name' => 'Estates',
'singular_name' => 'Estate',
),
'description' => __( 'This post type is used in RealEstast theme', PGL ),
'public' => TRUE,
'show_ui' => TRUE,
'hierarchical' => FALSE,
/* 'capability_type' => 'post',
'capability' => array(
'add_posts' => 'add_estates',
'publish_posts' => 'publish_estates',
'edit_posts' => 'edit_estates',
'edit_others_posts' => 'edit_others_estates',
'delete_posts' => 'delete_estates',
'delete_others_posts' => 'delete_others_estates',
'read_private_posts' => 'read_private_estates',
'edit_post' => 'edit_estate',
'delete_post' => 'delete_estate',
'read_post' => 'read_estate',
),*/
'supports' => array(
'title',
'editor',
'thumbnail',
),
'has_archive' => TRUE,
'rewrite' => array(
'slug' => 'estate',
'with_front' => TRUE
),
);
register_post_type( 'estate', $args );