Viewing 8 reply threads
  • Author
    Posts
    • #4726
      shayneol
      Member

      I have an editor field (I don’t know if this is happening with other fields) for a Custom Post Type. If I try to add an inline style to text within the editor or add a class to text that has styling, I cannot get the styling to output. I’ve tried the following code in a page template .php file and in the wordpress’ default content field and they work fine. However, If I put it in the editor, the styling does not output with the text. I’m using Piklist v.0.9.9.4

      Piklist Editor Field Code:

        piklist('field', array(
          'type' => 'editor'
          ,'field' => 'wim_text'
          ,'label' => 'Content'
      	,'template' => 'field'
          ,'options' => array(
            'wpautop' => true
            ,'media_buttons' => true
            ,'shortcode_buttons' => true
            ,'tabindex' => ''
            ,'editor_css' => ''
            ,'editor_class' => ''
            ,'teeny' => false
            ,'dfw' => false
            ,'tinymce' => array(
              'resize' => true
              ,'wp_autoresize_on' => true
            )
            ,'quicktags' => true
            ,'drag_drop_upload' => true
          )
        ));
      

      HTML Code That I’m Trying To Style Within The Editor:

      <div style="float:left; width:20%; height:500px">
      asdfasdf
      </div>
      
      <div style="float:left; width:20%; height:500px">
      asdfadf
      </div>
      
      <div style="float:left; width:20%; height:500px">
      asdfasdf
      </div>
      
      <div class="clear"></div>
      

      Floats aren’t the only thing that don’t work. Pretty much everything except Header tags do not work.

      Code Used To Output On Screen:

      <?php
      $wim_dance = get_post_meta($post->ID, 'wim_text', true);
      echo apply_filters('the_content', $wim_dance);
      ?>
      

      When I inspect the code in Safari, I notice additional characters being added to the code (Please see attached screenshot)

      Thanks,
      Shayne

      Attachments:
      You must be logged in to view attached files.
    • #4729
      Steve
      Keymaster

      What do you see in the Database? If the data is wrong there, this might be three sabe bug as: https://piklist.com/support/topic/single-quote-marks-are-backslashed-0-9-9-4/

    • #4730
      shayneol
      Member

      Hello Steve,

      It looks like the information in database is incorrect as well, with a slight difference. When inspecting the code from Safari, there are additional double-quotes that are not showing up in the database (though both views are incorrect).

      Attachments:
      You must be logged in to view attached files.
    • #4740
      Steve
      Keymaster

      This will be fixed in v0.9.9.5.

    • #4768
      shayneol
      Member

      Hey Steve,
      Would you be able to give an ETA on when this next version will be released?

    • #4769
      Steve
      Keymaster

      This week. Working on a few more things

    • #4790
      shayneol
      Member

      V.0.9.9.5 seems to resolve this issue. Thanks!!

      I do have a visual issue now. The description text for my groups now show below the group instead of to the left (below the group label). This is a minor issue, but I still would like to report it.

        piklist('field', array(
          'type' => 'group'
          ,'field' => 'message_item'
          ,'add_more' => true
          ,'label' => 'Add Message'
          ,'description' => 'Add messages for this series. You may add as many messages as needed by clicking the blue "+" button.  To add a completely new series, click on the "Add New" button at the top of the page.'
          ,'fields' => array(
            array(
              'type' => 'text'
              ,'field' => 'title'
              ,'label' => 'Message Title'
              ,'template' => 'field'
              ,'columns' => 12
      		,'attributes' => array(
      		  'class' => 'large-text'
      		  ,'placeholder' => 'Message Title'
      		)
            )
            ,array(
      		'type' => 'datepicker'
      		,'field' => 'date'
      		,'label' => 'Date'
              ,'template' => 'field'
      		,'options' => array(
      			'dateFormat' => 'yy/mm/dd'
      		)
      		,'attributes' => array(
      			'size' => 12
      		  	,'class' => 'large-text'
      			,'placeholder' => 'Date'
      		)
            )
      
            ,array(
              'type' => 'text'
              ,'field' => 'speaker'
              ,'label' => 'Speaker'
              ,'template' => 'field'
              ,'columns' => 12
      		,'attributes' => array(
      		  'class' => 'large-text'
      		  ,'placeholder' => 'Speaker'
      		)
            )
      	  
            ,array(
              'type' => 'text'
              ,'field' => 'video_url'
              ,'label' => 'Youtube URL'
              ,'template' => 'field'
              ,'columns' => 12
      		,'attributes' => array(
      		  'class' => 'large-text'
      		  ,'placeholder' => 'Youtube URL'
      		)
            )
      
          )
        ));
      
        
      ?>
      
      Attachments:
      You must be logged in to view attached files.
    • #4792
      Kevin
      Keymaster

      @shayneol-

      We actually moved the description on the default field template to the bottom of the field to be more consistent with the wp-admin style guide. However you can change it if you like by defining your own field template or modifying the one being used, in this case ‘post_meta’

      Let us know if you need anything else.

      Kevin

      add_filter('piklist_field_templates', 'my_field_templates');
      function my_field_templates($templates)
      {
        $templates['post_meta']['template'] = '[field_wrapper]
                                                 <div class="%1$s piklist-field-container">
                                                   <div class="piklist-field-container-row">
                                                     <div class="piklist-label-container">
                                                       [field_label]
                                                       [field_description_wrapper]
                                                         <p class="piklist-field-description description">[field_description]</p>
                                                       [/field_description_wrapper]
                                                     </div>
                                                     <div class="piklist-field">
                                                       [field]
                                                     </div>
                                                   </div>
                                                 </div>
                                               [/field_wrapper]';
                                                
        return $templates;
      }
    • #4826
      Steve
      Keymaster

      @shayneol– The description will be put back to it’s old position in the next version of Piklist. After review, we agree it should be there.

Viewing 8 reply threads
  • The topic ‘Cannot output inline styles within editors’ is closed to new replies.