PHP code example of offsetwp / editor-support

1. Go to this page and download the library: Download offsetwp/editor-support library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

offsetwp / editor-support example snippets


use OffsetWP\EditorSupport\EditorSupportManager;

$editor = EditorSupportManager::from_post_type( 'page' );
$editor
    ->set_classic_editor()
    ->remove_comments();

$editor = EditorSupportManager::from_post_type( 'page' ); // With post type
$editor = EditorSupportManager::from_post_id( 42 ); // With post ID
$editor = EditorSupportManager::from_template( 'template/contact.php' ); // With template name

$editor->set_gutenberg_editor(); // Gutenberg
$editor->set_classic_editor(); // Classic Editor
$editor->set_empty_editor(); // No editor

$editor
    ->add_title()
    ->add_editor()
    ->add_author()
    ->add_thumbnail()
    ->add_excerpt()
    ->add_trackbacks()
    ->add_custom_fields()
    ->add_comments()
    ->add_revisions()
    ->add_page_attributes()
    ->add_post_formats();

$editor->add_support( 'my-custom-feature' );

$editor
    ->add_all() // Add all features
    ->add_all( array( 'content', 'thumbnail' ) ); // Add all features without specific ones

$editor
    ->remove_title()
    ->remove_editor()
    ->remove_author()
    ->remove_thumbnail()
    ->remove_excerpt()
    ->remove_trackbacks()
    ->remove_custom_fields()
    ->remove_comments()
    ->remove_revisions()
    ->remove_page_attributes()
    ->remove_post_formats();

$editor->remove_support( 'my-custom-feature' );

$editor
    ->remove_all() // Remove all features
    ->remove_all( array( 'content', 'thumbnail' ) ); // Remove all features without specific ones