Viewing 2 reply threads
  • Author
    Posts
    • #7827
      norboo
      Member

      I’m trying to replace “post_excerpt” and “post_content” with Piklist editor fields and everything seems to work fine with one exception: I can’t completly delete the content of either of these fields, I must have at least an empty space ” ” for the fields to save.

      
      <?php
      /*
      Title: Content
      Post Type: page, post, tour (a CPT)
      */
      
      piklist('field', array(
          'type' => 'editor'
          ,'scope' => 'post'
          ,'field' => 'post_content'
          ,'label' => 'Content'
          ,'template' => 'field'
          ,'description' => 'This is a custom Content'
          ,'value' => ' '
          ,'options' => array(
            'wpautop' => true
            ,'media_buttons' => true
            ,'shortcode_buttons' => true
            ,'teeny' => false
            ,'dfw' => false
            ,'tinymce' => array(
              'resize' => false
              ,'wp_autoresize_on' => true
            )
            ,'quicktags' => true
            ,'drag_drop_upload' => true
          )
          ,'on_post_status' => array(
            'value' => 'lock'
          )
        ));
      
      <?php
      /*
      Title: Excerpt
      Post Type: post, page, tour (CPT)
      */
      
      piklist('field', array(
          'type' => 'editor'
          ,'scope' => 'post'
          ,'field' => 'post_excerpt'
          ,'label' => 'Excerpt'
          ,'template' => 'field'
          ,'description' => 'This is a custom Excerpt'
          ,'options' => array(
            'wpautop' => true
            ,'media_buttons' => true
            ,'shortcode_buttons' => true
            ,'teeny' => false
            ,'dfw' => false
            ,'tinymce' => array(
              'resize' => false
              ,'wp_autoresize_on' => true
            )
            ,'quicktags' => true
            ,'drag_drop_upload' => true
          )
          ,'on_post_status' => array(
            'value' => 'lock'
          )
        ));
      
      //functions.php
      function my_remove_post_type_support()
      { 
          remove_post_type_support('post', 'excerpt');
          remove_post_type_support('post', 'editor');
          remove_post_type_support('post', 'custom-fields');
          
          remove_post_type_support('page', 'editor');
          remove_post_type_support('page', 'excerpt');
          remove_post_type_support('page', 'custom-fields'); 
      }
      add_action('init', 'my_remove_post_type_support',10);
      
    • #7842
      Steve
      Keymaster

      That’s really odd. Try deleting this from each field since you don’t need it:

      ,'on_post_status' => array(
            'value' => 'lock'
          )
    • #8334
      matrosero
      Participant

      Hi, I’m having the same issue. Here’s my code:

      piklist(‘field’, array(
      ‘type’ => ‘editor’,
      ‘scope’ => ‘post’,
      ‘template’ => ‘field’,
      ‘field’ => ‘post_excerpt’,
      ‘options’ => array (
      ‘media_buttons’ => false,
      ‘teeny’ => false,
      ),
      ));

Viewing 2 reply threads
  • You must be logged in to reply to this topic.