How do I allow certain users to make a certain type of post?

The following will assign capability requirements to your CPT. So, users will require edit_community, delete_community etc capabilities to perform those actions. function createCommunityPostType() { $args = array( ‘public’ => true, ‘label’ => ‘Community’ ‘capability_type’ => ‘community’, ‘map_meta_cap’ => true ); register_post_type(‘community’, $args ); } add_action(‘init’, ‘createCommunityPostType’); See the parts about capabilities in the codex. You … Read more

How do I get from search_theme_directories() to the $stylesheet (name) for switch_theme()

But I can’t seem to sort out how to get the $stylesheet. Easy. $themes = search_theme_directories(); // a random theme $themename = array_rand($themes,1); // that random theme’s stylesheet $stylesheet = content_url(‘/themes/’.$themes[$themename][‘theme_file’]); // The absolute path to that theme’s stylesheet $stylepath = WP_CONTENT_DIR.’/themes/’.$themes[$themename][‘theme_file’]; Getting a random theme that is not a child is more involved. I … Read more

WordPress plugin with its own “site”/theme

I don’t quite know what you mean by “include a theme” and you are talking about a potentially large and complicated project but I think you should be able to control the display of your plugin content with the template_redirect hook. function template_redir_wpse_99209($content) { // code or file include, for example // exit; } add_action(‘template_redirect’,’template_redir_wpse_99209′,1); … Read more