PHP code example of matgargano / acf-medium-editor-field

1. Go to this page and download the library: Download matgargano/acf-medium-editor-field 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/ */

    

matgargano / acf-medium-editor-field example snippets


add_filter('medium-editor-theme', 'my_medium_editor_theme_function');
function my_medium_editor_theme_function($theme) {
  $theme = 'beagle';
  return $theme;
}

// functions.php

function my_custom_buttons($buttons, $field) {
  $buttons[] = array(
    'name' => 'red',
    'tag' => 'span',
    'label' => '<b title="Title for button" style="color: #F00;"><i class="dashicons dashicons-NAME"></i></b>',
    'attributes'  => array(
      array(
        'name' => 'style',
        'value' => 'color: #F00;'
      ),
      array(
        'name' => 'class',
        'value' => 'myClass'
      )
    )
  );
  return $buttons;
}
add_filter('acf/medium-editor-field/custom-buttons', 'my_custom_buttons', 10, 2);

// functions.php

function my_custom_buttons($buttons, $field) {
  // add underline button to all medium editor fields
  // set both the index and the value of the array element
  if (!isset($buttons['underline'])) {
    $buttons['underline'] = 'underline';
  }
  return $buttons;
}
add_filter('acf/medium-editor-field/buttons', 'my_buttons', 10, 2);

add_filter('remove_hube2_nag', '__return_true');