Suggestion
Support › MB Include Exclude › SuggestionResolved
- This topic has 4 replies, 2 voices, and was last updated 8 years, 1 month ago by
Anh Tran.
-
AuthorPosts
-
March 28, 2017 at 6:52 PM #5411
carassius
ParticipantWould be good to be able to disable default WordPress functions such as editor, thumbnails, excerpt etc
ACF has this functionality and would be great to have it included, especially using the builder as you could have them as checkboxes
March 29, 2017 at 10:25 AM #5422Anh Tran
KeymasterDoes this belong to the post type object itself? I think it's easy to do it with the
remove_post_type_support
function (https://developer.wordpress.org/reference/functions/remove_post_type_support/).March 29, 2017 at 11:12 AM #5425carassius
ParticipantYes, but conditional
Eg: this is the function I wrote that determines the home page and then removes the editor with the
remove_post_type_support
/* * Hide editor on home page * Since v1.0.0 */ function homepage_hide_editor() { // Determine which admin screen we are in $screen = get_current_screen(); // Ensures we are currently editing if ( $screen->base != 'post' ) { // If not editing then escape function return; } else { // Get the home page ID $frontpage_id = get_option('page_on_front'); // Get current post ID $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID']; // Checks current post ID matches home page ID if($post_id == $frontpage_id){ // Removes editor from home page remove_post_type_support('page', 'editor'); } } } add_action( 'current_screen', 'homepage_hide_editor' );
March 29, 2017 at 11:20 AM #5426carassius
ParticipantI would like to see something like this perhaps
$meta_boxes[] = array( 'title' => __( 'Include/Exclude', 'wcd-tradie' ), 'post_types' => 'page', // Which page to show on 'include' => array( 'slug' => array( 'home' ), ), // What fields to remove from page 'exclude' => array( 'type' => array( 'editor', 'thumbnail', 'revisions' ), ), 'fields' => array( array( 'id' => 'text', 'name' => __( 'Text', 'language' ), 'type' => 'text', 'std' => __( 'A Text Field', 'language' ), ), ), );
March 31, 2017 at 3:32 PM #5449Anh Tran
KeymasterOK, I got it. It's actually beyond the scope of the plugin. Include/exclude here means for meta boxes and what you want seems to be for post elements. I will think about this and if it's not hard to implement, I will do it.
-
AuthorPosts
- You must be logged in to reply to this topic.