Suggestion

Support MB Include Exclude SuggestionResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5411
    carassiuscarassius
    Participant

    Would 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

    #5422
    Anh TranAnh Tran
    Keymaster

    Does 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/).

    #5425
    carassiuscarassius
    Participant

    Yes, 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' );
    #5426
    carassiuscarassius
    Participant

    I 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' ),
            ),
            
        ),
    );
    
    #5449
    Anh TranAnh Tran
    Keymaster

    OK, 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.