Support

Account

Home Forums Search Search Results for 'Wysiwyg'

Search Results for 'Wysiwyg'

reply

  • Hi @jari-pennanen

    Thanks for the post.

    It is possible to modify the dimensions of the WYSIWYG editor by hooking into the acf/input/admin_head action and passing some new styles.

    Please have a look at this example:

    add_action('acf/input/admin_head', 'lh_acf_admin_head'); 
    function lh_acf_admin_head() {
            ?>
            <style type="text/css">
    
            .acf-field-5639b8dd6170b .acf-editor-wrap iframe {
                height: 150px !important;
                min-height: 150px;
            }
            .acf-field-5639b8dd6170b .acf-editor-wrap .mce-fullscreen iframe{
                height: 700px !important;
                min-height: 700px;
            }
    
            </style>
            <?php
    } 
  • @elliot Is there a possibility to add this as a setting soon as i often find I’m having to add css to do this change manually. More than anything it does’t seem a very suitable solution as due to the complex rendering of the wysiwyg element in most browsers the resizing of the iframe via code such as that shown above only comes into effect a second or so after the page has visibly rendered, resulting in a noticeable change and moving of all content below the field.

  • Thanks John!

    I’d been copying and pasting from a pdf in MAC’s Preview program. It never occurred to me that extraneous markup was stowed away. I should’ve checked the Text view of the WYSIWYG as well.

    Glad to know that it was operator error.

    –Seth

  • Thanks John.

    James from support also sent me the info below, I’ve forwarded that in to Paul at member press to look at.

    “Thanks for the email.

    I had a look at the discussion and just to add my input perhaps you could have the guys over at Memberpress also hook into the acf_the_content global filter for getting the acf content within WYSIWYG custom fields.

    Please have a look at the following resource page for more info: http://hookr.io/filters/acf_the_content/

    I hope this helps.”

  • Just checked and the default behaviour when using the standard wp wysiwyg is to replace the content with the sign up form.

  • Ah, interesting point you’ve made there. Is member press redirecting or just replacing the content with the sign up/login.
    I may be wrong in thinking its redirecting, I’ll check the page urls.

    If the content is in the default wysiwyg wp editor (the_content) it shows the sign up if not logged in.

    If the content is in a acf area, nothing happens, it still shows the content (or a blank page if the code I pasted above is used)

    I have asked member press to view this thread and let us know their comments.

  • 1 year and 3+ months later….

    Hello – I just had this problem with Flexible Content, too. I can’t really see a pattern with it. It occurs on WYSIWYG editors and I get the same markup as mladen.

    <div class="page" title="Page 1">
    <div class="section">
    <div class="layoutArea">
    <div class="column">

    Does anyone know what’s causing this and how to avoid it?

    Thanks,
    Seth

  • Doe the shortcode that you’re adding contain those special quote characters? The reason why I ask is that shortcodes work in acf wysiwyg fields it it’s a valid shortcode and the only reason it shouldn’t be working is that there might be something wrong with the shortcode.

  • ACF only runs shortcodes on wysiwyg fields by default. In order to let the shortcode be run on another field you need to add a filter for that field and call do_shortcode

    http://www.advancedcustomfields.com/resources/acfformat_value/
    the filter as I’m using it here is not documented. name and key are later additions.

    change acf_field_name to the field name where you want to include the shortcode. You may need to include the post id value in the shortcode you add to the acf field.

    http://www.advancedcustomfields.com/resources/shortcode/

    
    add_filter('acf/format_value/name=acf_field_name', 'acf_field_do_shortcodes', 10, 3);
    function acf_field_do_shortcodes($value, $post_id, $field) {
      if ($value) {
       $value = do_shortcode($value);
      }
      return $value;
    }
    
  • Hi @wzshop

    I’m afraid you can’t do it. Visual Composer has a lot of customized functions that will be hard to duplicate in other sections. You can always create the layout from visual composer and then get the result by changing your editor to the classic text editor. After that, just copy the content to a WYSIWYG field.

    I hope this helps.

  • Hi @jamesjames

    Thanks for the question.

    You can make use of the wysiwyg_tinymce_settings filter to customize these settings.

    The code will look like so:

    acf.add_filter('wysiwyg_tinymce_settings', function( mceInit, id ){
    	
    	// do something to mceInit
    	
    	
    	// return
    	return mceInit;
    			
    });

    I hope this helps.

  • Hi @manioums

    This is weird. I’ve just tried it again on my installation, and the basic uploader setting didn’t load those libraries. Another weird thing is that the WYSIWYG field always loads those libraries, even with the basic setting.

    Could you please tell me what ACF version do you use? Also, could you please share the JSON export of your field group so I can test it out on my installation?

    Thanks!

  • Hi @james,

    Thank for your answer,

    post_content is set to fasle, i do have a WYSIWYG on the page but set to basic.
    The problem is not linked to this WYSIWYG basic editor because wheb i remove the Image Field completly, all the WordPress Upload Libray is is not loaded on the page anymore (and my basic WYSIWYG editor is still here).

    Can you give me a fix in order to don’t have thoses very big library when the uploader is set to basic ?

    Thank again 🙂

  • Hi @manioums

    Did you set the ‘post_content’ option to true or had a WYSIWYG field in the form? If you did, ACF’s need those library to make the WYSIWYG editor works correctly.

    If you didn’t have that option or field, those libraries shouldn’t be loaded.

    I hope this helps 🙂

  • Following up on @sdempsey I found that loading pages with large numbers of TinyMCE fields caused the issue. Disabling TinyMCE “fixed” the issue, except that the client isn’t going to be learning HTML to make changes.

    I was also able to get the page load, though at an incredibility slow speed, by switching the WYSIWYG fields to Basic.

    My current solution is to force the page to load in HTML, then to switch to WYSIWYG after load.

    In functions.php, I am adding to @sdempsey code:

    function load_custom_wp_admin_style_scripts() {
        wp_enqueue_script( 'admin-script', get_template_directory_uri() . '/assets/js/admin.min.js', array( 'jquery' ), '20120202', true );
    }
    add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style_scripts' );
    

    For the admin JS, all I am doing it clicking on all of the Visual switch buttons after the page loads.

    jQuery(document).ready( function(){ 
    	jQuery('.wp-switch-editor.switch-tmce').click()
    });

    Not a great solution, but it’s working for now.

  • Sure thing! So, we have a lot of articles. All of them about films. I want to compile a list of those films, ordered by the first letter of each title. Currently I have it set up as follows:

    Underneath the WYSIWYG-editor when writing an article, there’s an ACF for selecting the first letters of each film that appears in the article. When you select the letters, you get text areas into which you type, one row at a time, the names of the films in the text. Example:

    Then I use this data to create a page for each letter on the site that looks like this (the letters at the top link to the other pages but are non-functional for the moment until I lock this down):

    The code for this page looks like this:

    <?php get_header(); ?>
    
    <section class="content">
    
    	<?php get_template_part('inc/page-title'); ?>
    	
           <div class="pad group">
    
    <div class="entry">	
    						<div class="entry-inner">
    							<?php the_content(); ?>
    							<?php wp_link_pages(array('before'=>'<div class="post-pages">'.__('Pages:','hueman'),'after'=>'</div>')); ?>
    						</div>
    						<div class="clear"></div>				
    					</div><!--/.entry-->
    		
    <?php
    
    $posts = get_posts(array(
    	'numberposts' => -1,
    	'meta_key' => 'elokuvat_k',
            'order'=> 'ASC',
            'orderby' => 'elokuvat_k'
    ));
    
    if($posts)
    {
    	echo '<ul>';
    
    	foreach($posts as $post)
    	{
    		echo '<li><a href="' . get_permalink($post->ID) . '">' . get_field($field_name='elokuvat_k', $post->ID) . '</a></li>';
    	}
    
    	echo '</ul>';
    }
    
    ?>
    
    	</div><!--/.pad-->
    	
    </section><!--/.content-->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    This is all good. However, it becomes a problem if an article has two films in it that begin with the same letter. For example, if I add a film like this:

    Then it will show up like this on the page:

    The problem is that instead of creating two data entries, one of which would be Knock Knock (2015) and the other Kxick Test (2014), it creates a single entity which is known as
    Knock Knock (2015)
    Kxick Test (2014)

    This causes the alphabetical order of that page to become messy, as the lower of these two should be below, in this case, Kummeli V (2014), since it comes later in the alphabet.

    I wanted to know if there is any way to make it so that when entering multiple rows of text into the text area -box, the inputs would create their individual values into the database that the code takes them from, ergo instead of creating this single block of content it would create two separate ones.

  • I just finished reading through this thread and am still having a similar problem today as the one this thread describes. The agency I work for has started using flexible content fields to make our designs modular. Each module typically has it’s own flexible content layout. One such layouts uses a repeater to provide the user with column layouts. Each row of the repeater represents a “column” in that layout. Among the options in each row there is a content field that uses a WYSIWYG.

    I noticed page load suffering in a big way the further i got into development. Each time I added a new column layout, each with it’s own set of WYSIWYG Editors, the longer it took to reload/load the page.

    In development I was laying out a design that featured several variations of 1, 2, 3, 4 column layouts. In all there are 39 editors on this page causing a page load time of 18+ seconds. I understand this is an extreme case but this is hardly the only layout where WYSIWYG editors are going to be. After a couple hours debugging I came across an old support forum post suggesting that setting the default tab to “text” on the editor might solve the problem. I dug into the codex and learned that there is a filter for doing exactly that.

    Solution might be a strong word. I definitely saw an improvement. Using this function i was able to reduce the load time by more than 10s. From an average of 18.41s to 8.37s

    //set default tab on WYSIWYG
    //return html for the "Text" tab
    //return tinymce for "Visual" tab
    function tiny_mce_default_tab() {
        return 'html';
    }
    
    add_filter('wp_default_editor', 'tiny_mce_default_tab');

    I hope this will help someone else as frustrated by this issue as I’ve been. If you discover an actual solution to this I would greatly appreciate a reply to this post.

    Love,
    Sean

  • Hi James
    Thak you!

    This is my JSON-File.
    “field_56c19dd4c3e9c” is the repeater I want the alphabetical list of.

    
    {
        "key": "group_56cd64f9096fa",
        "title": "Veranstaltungen",
        "fields": [
            {
                "key": "field_54c7409720a78",
                "label": "Date",
                "name": "date",
                "type": "date_picker",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "display_format": "l, d. F Y",
                "return_format": "Ymd",
                "first_day": 1
            },
            {
                "key": "field_54c7412220a79",
                "label": "Time",
                "name": "time",
                "type": "text",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "maxlength": "",
                "readonly": 0,
                "disabled": 0
            },
            {
                "key": "field_54c7a407e1264",
                "label": "Event-Type",
                "name": "type",
                "type": "text",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "maxlength": "",
                "readonly": 0,
                "disabled": 0
            },
            {
                "key": "field_54c7a45be1265",
                "label": "Entry fee",
                "name": "entry",
                "type": "text",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "maxlength": "",
                "readonly": 0,
                "disabled": 0
            },
            {
                "key": "field_54d9d07b10c0a",
                "label": "Supporting Act",
                "name": "support",
                "type": "text",
                "instructions": "Supporting-Act",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "maxlength": "",
                "readonly": 0,
                "disabled": 0
            },
            {
                "key": "field_54c8992084720",
                "label": "Links",
                "name": "links",
                "type": "repeater",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "row_min": "",
                "row_limit": "",
                "layout": "table",
                "button_label": "Add new link",
                "min": 0,
                "max": 0,
                "collapsed": "",
                "sub_fields": [
                    {
                        "key": "field_54c8992e84721",
                        "label": "Linkname",
                        "name": "linkname",
                        "type": "text",
                        "instructions": "",
                        "required": 0,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "default_value": "",
                        "placeholder": "",
                        "prepend": "",
                        "append": "",
                        "formatting": "html",
                        "maxlength": "",
                        "readonly": 0,
                        "disabled": 0
                    },
                    {
                        "key": "field_54c8993c84722",
                        "label": "Linkadresse",
                        "name": "linkadresse",
                        "type": "text",
                        "instructions": "",
                        "required": 0,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "default_value": "",
                        "placeholder": "",
                        "prepend": "",
                        "append": "",
                        "formatting": "html",
                        "maxlength": "",
                        "readonly": 0,
                        "disabled": 0
                    }
                ]
            },
            {
                "key": "field_56c19dd4c3e9c",
                "label": "Artists",
                "name": "artists",
                "type": "repeater",
                "instructions": "This field is used for the Artist-List.",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "row_min": "",
                "row_limit": "",
                "layout": "table",
                "button_label": "Add Artist",
                "min": 0,
                "max": 0,
                "collapsed": "",
                "sub_fields": [
                    {
                        "key": "field_56c19de1c3e9d",
                        "label": "Artist Name",
                        "name": "artistname",
                        "type": "text",
                        "instructions": "",
                        "required": 0,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "default_value": "",
                        "placeholder": "",
                        "prepend": "",
                        "append": "",
                        "formatting": "html",
                        "maxlength": "",
                        "readonly": 0,
                        "disabled": 0
                    },
                    {
                        "key": "field_56c1abe6bf667",
                        "label": "Artist-Website",
                        "name": "artistweb",
                        "type": "text",
                        "instructions": "",
                        "required": 0,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "default_value": "",
                        "placeholder": "",
                        "prepend": "",
                        "append": "",
                        "formatting": "html",
                        "maxlength": "",
                        "readonly": 0,
                        "disabled": 0
                    }
                ]
            },
            {
                "key": "field_54e5d86e27b60",
                "label": "Presales",
                "name": "presales",
                "type": "text",
                "instructions": "Link zur Vorverkaufsseite \"http:\/\/www....\"",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "maxlength": "",
                "readonly": 0,
                "disabled": 0
            },
            {
                "key": "field_54c8b1bf11fde",
                "label": "Image Gallery",
                "name": "gallery",
                "type": "repeater",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "collapsed": "",
                "min": "",
                "max": "",
                "layout": "table",
                "button_label": "Fotos hinzuf\u00fcgen",
                "sub_fields": [
                    {
                        "key": "field_54c8b1dc11fdf",
                        "label": "Bild",
                        "name": "bild",
                        "type": "image",
                        "instructions": "",
                        "required": 0,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "preview_size": "thumbnail",
                        "library": "all",
                        "return_format": "id",
                        "min_width": 0,
                        "min_height": 0,
                        "min_size": 0,
                        "max_width": 0,
                        "max_height": 0,
                        "max_size": 0,
                        "mime_types": ""
                    }
                ]
            },
            {
                "key": "field_54cb98c819900",
                "label": "R\u00e9sum\u00e9",
                "name": "resume",
                "type": "wysiwyg",
                "instructions": "Das ist ein abschliessender Text zum Event. Dieser wird angezeigt sobald Fotos in der Fotogalerie sind.",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "tabs": "all",
                "toolbar": "full",
                "media_upload": 1
            }
        ],
        "location": [
            [
                {
                    "param": "post_type",
                    "operator": "==",
                    "value": "post"
                }
            ]
        ],
        "menu_order": 5,
        "position": "normal",
        "style": "seamless",
        "label_placement": "top",
        "instruction_placement": "label",
        "hide_on_screen": "",
        "active": 1,
        "description": "",
        "modified": 1456303465
    }
    
  • It’s a good thing you don’t have many of them because I don’t know any way to import something that’s in HTML into ACF, unless you wanted to import them into a WYSIWYG editor and I think that might defeat your purpose.

  • Hi @inforesist

    I’m not sure which thread you are referring to, but could you please try this code?

    function custom_field_excerpt() {
        global $post;
        $text = get_field('wysiwyg_test', $post->ID);
        if ( '' != $text ) {
            $text = strip_shortcodes( $text );
            $text = apply_filters('the_content', $text);
            $text = str_replace(']]>', ']]>', $text);
            $excerpt_length = 20; // 20 words
            $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
            $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
        }
        return apply_filters('the_excerpt', $text);
    }

    Hope this helps.

  • Hi @radirot

    I’m not sure why it isn’t working, but you can always use acf/load_value and str_replace to change that tags automatically for WYSIWYG custom field. You can use this code to do it:

    function my_acf_load_value( $value, $post_id, $field )
    {
        // run the_content filter on all textarea values
        $value = apply_filters('the_content',$value); 
        $value = str_replace("<!--more-->", '<span id="more-'. $post_id .'"></span>', $value);
    
        return $value;
    }
    
    add_filter('acf/load_value/type=wysiwyg', 'my_acf_load_value', 10, 3);

    I hope this helps.

  • If you’re trying to circumvent needing WP to load completely then you might want to take look at accessing the repeater field directly using get_option() instead of get_field(). To be 100% honest, I almost never use get_field() or most of the other functions built into ACF, basically because I want everything to work should ACF be deactivated for some reason…. of course if this is more than simple fields, like images or wysiwyg editors then it can be a lot more work. Here’s an example.

    
    // the options name used by ACF to store the repeater
    $repeater = 'options_'.$your_repeater_field_name;
    // array of sub field names
    $subfields = array(
      'field_1' => 'text',
      'field_2' => 'image',
      'field_3 => 'wysywig'
    );
    // place to put the repeater values
    $values = array();
    $count = intval(get_option($repeater, 0));
    for ($i=0; $i<$count, $i++) {
      $value[] = array();
      foreach ($subfields as $subfield => $type) {
        $value[$subfield] = get_option($repeater.'_'.$i.'_'.$subfield, '');
        switch($type) {
          case 'image':
            $value[$subfield] = wp_get_attachment_image_src(intval($value[$subfield]), 'full');
            break;
          case 'wysiwyg':
            $value[$subfield] = apply_filters('the_content', $value[$subfield]);
            break;
          case 'text';
          default:
            // do nothing;
        }
      } // end foreach $subfield
      $values[] = $value;
    } // end for $i
    
  • Hi @whatsupskip

    When you changed the field type, the data will still be there as long as you don’t update the post/page. ACF will check if the existing data is compatible with the new field type and just ignore it if it isn’t compatible.

    In your case, it should be compatible because both TextArea and Wysiwyg editor uses string to store the data.

    I hope this makes sense.

  • it seems the issue is caused by several WYSIWYG editors on page.

Viewing 25 results - 676 through 700 (of 1,298 total)