Viewing 3 reply threads
  • Author
    Posts
    • #6465

      I’ve created my Editor fields and then show up just fine in the metaboxes; but they simply don’t post anything because no matter what try, I can’t any values stored by them. Even at the time of updating a page where I display those metaboxes in which they are, they show no previous content entered in them like the rest of the fields do. I’ve tried copying and using some editor field code from the documentation itself and from the Piklist demo pages but still I get nothing when i try to access their values to show on the frontend. I’m confused and I feel burned out from trying them. Someone please help me out here because using a textarea isn’t in my best interest instead of an editor field because the content may carry some formatting that only the editor can allow.

    • #6470
      Steve
      Keymaster

      @semwangajoshua- Please post your code here and we’ll take a look.

    • #6473

      Here’s what I have in my metaboxes parts folder:

      //Section 2 Content
        piklist('field', array(
          'type' => 'editor'
          ,'scope' => 'post'
          ,'field' => 'sctn2_content'
          ,'label' => __('Section 2 content')
          ,'description' => __('Content to appear after the sub-headline')
          ,'help' => 'Content to appear after the sub-headline'
          ,'value' => ''
          ,'placeholder' => 'Content here'
          ,'options' => array (
            'wpautop' => true
            ,'media_buttons' => false
            ,'tabindex' => ''
            ,'editor_css' => ''
            ,'editor_class' => ''
            ,'teeny' => false
            ,'dfw' => false
            ,'tinymce' => true
            ,'quicktags' => true
          )
        ));<code></code>

      And this is how I access the values:
      <?php echo wpautop(get_post_meta($post->ID, 'sctn2_content', true)); ?>

      And for some reason I that I don’t understand, everytime I try to update a page with after enter new content into the editor field, WordPress throws up the error below:

      <br />
      <b>Fatal error</b>:  Maximum execution time of 30 seconds exceeded in <b>C:\xampp\htdocs\lawyeah\wp-includes\wp-db.php</b> on line <b>1803</b><br />

      This happens for when I try update a page and part of the new data to be posted is that of the Editor field.

    • #6476
      Steve
      Keymaster

      @semwangajoshua– You have some conflicting code here:

      'scope' => 'post': means you want to save this data to the wp_posts table
      'field' => 'sctn2_content': means you want to save this data to the field sctn2_content. HOWEVER, sctn2_content is not part of the wp_posts table.

      I’m guessing you want to save this as post_meta, so just remove the scope parameter and it should work.

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