Support

Account

Home Forums Search Search Results for 'Wysiwyg'

Search Results for 'Wysiwyg'

reply

  • Hello,

    Thank your for your reply.

    The modal is in the main page and the content is loaded with an ajax call. I use wordpress ajax :

    php :

    function load_acf_form_ajax() {
    
        // variables
        if (!empty($_POST['fields_key']) && !empty($_POST['user_id'])) {
            $fields_key = $_POST['fields_key'];
            $user_id = $_POST['user_id'];
    
            // formulaire ACF form
            $options = array(
                'post_id' => 'user_' . $user_id, // $user_profile,
                'fields' => array($fields_key),
                'form' => true,
                'submit_value' => 'Valider'
            );
    
            acf_form($options);
            
            
        } else {
            echo 'erreur';
        }
    
        get_template_part('templates/modal-edit-acf');
    
        die();
    }

    JS :

    jQuery.post(
                            ajaxurl,
                            {
                                'action': 'load_acf_form_ajax',
                                'fields_key': $field_key,
                                'user_id': <?php echo $user_id_parameter; ?>
                            },
                            function (response, status) {
                                //console.log(response);
                                $('#modal_content').html(response);
                                console.log('status : ' + status);
    
                                if (status === 'success') {
                                    console.log('acf.do_action');
    //                                acf.do_action('ready', $('#modal_content'));
    //                                acf.do_action('load', $('#modal_content'));
    //                                acf.fields.wysiwyg.initialize();
                                    acf.do_action('append', $('#modal_content'));
    //                                $(document).trigger('acf/setup_fields', $('#modal_content'));
                                } else {
                                    $('#modal_content').html(status);
                                }
                            }
                    );

    Eliot helped me to debug this.

    It was simple (i don’t know how i could miss it).

    The solution is : trigger the ‘append’ action within the ajax success function after you have appended your HTML

    So, now it works but i still have issue with the wysiwyg editor, or the datepicker.

    It is due to missing JS files on the page because form is run within an AJAX call.

    I know i have to add acf_enqueue_uploader(); but it still doesn’t wok.

    Regards,

    Sébastien

  • I have the same issue with the latest version. I’m using tab groups and a bunch of wysiwygs. The first one in the first tab i shown. The rest of them are not. Same error message as above. Happens for Chrome Mac/Win.

    Edit: Well, it actually works on 2 out of 7. Seems random.

    Edit 2: Turns out you cannot use certain characters in the name. Since it evaluates to an expression. The guys who originally wrote the used “:” in the name, which of course can’t be used as an selector.

    Edit 3: Other weird errors has emerged.
    load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery…:570 Uncaught Error: Syntax error, unrecognized expression: a[href*=#], a[name*=#]

    input.min.js?ver=4.4.7:formatted:1323 Uncaught TypeError: Cannot set property 'toolbar1' of undefined

    Edit 4: Found the issue the child theme’s main js.

    $body.on('click', 'a[href*="#"], a[name*="#"]', function(event) {
    ...
    return false;
    }

    And tinymce is using a trigger(‘click’) in a few places.

    Not sure WHAT someone was thinking writing that code.

  • I tested this on both ACF 4 & 5 (wasn’t sure what version your using) and the WYSIWYG fields in both are working correctly. More than likely if there is some incompatibility with another plugin or your theme. You should start by deactivating plugins or switching themes to see what is causing the problem. If you can narrow that down there might be something we can do about it.

  • We have the exact same problem. We are using flex content with wysiwyg and some other fields and the backend is unusable. Scrolling will kill the browser. There is a serious issue with the JS in the ACF version. We are using pro btw.

    Could the developers please have a look at this.
    At the moment, the plugin is not scalable for bigger, more complex environments. We would love to use ACF for future projects, but this really concerns me.

  • I have found that you need to be a little careful about how complex you build field groups. On of the sites I build the client needed to ability to add multiple section to page. Each section could have up to 7 WYSIWYG editors. Each of these editors also had various layout controls for borders, padding, font settings, etc. This worked fine at first by then the client added a page with 20 sections, that’s 140 WYSIWYG editors. The update process timed out. There really isn’t a solution unless someone comes up with a way to update all of those fields in the postmeta table in a single query rather than one at a time.

    As far as getting information @gecugamo is correct. When using image fields you’re better off returning the ID and then doing the work yourself. ACF building of image objects is a serious drain and can take a long time, especially if you have a lot of custom image sizes.

  • Hi @carxofa

    I believe you can use acf_form() to do it. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/.

    You can also use the acf/save_post hook to change the post content based on the WYSIWYG field by using the wp_update_post() function. But if you use ACF Pro, you can simply use the “post_content” option.

    I hope this helps.

  • James —

    I found the problem; it was in the template.

    I was using the generic WordPress function for calling the value of custom fields, which apparently works with just about everything but the wysiwyg editor. I employed this form:

    <?php echo get_post_meta($post->ID, 'text', true); ?>

    instead of

    <?php the_field('text'); ?>

    Once I changed it, everything worked fine.

    So always assume an ID 10t error when something like this occurs. Thanks for all your help; sorry to have been a time-waster.

  • Update —

    I copied over the wysiwyg.php template to Twenty Fifteen, and activated that theme…and the problem went away. So it apparently isn’t a custom function, since there isn’t one, but one that exists in Twenty Fifteen that doesn’t exist in the custom theme. Do you have any insight into what that might be?

  • Hi @skd

    I believe the WYSIWYG field will add the <p> tags automatically like the WordPress editor. The code I gave you before is used to remove the generated <p> tags, so the result will be something like the issue you have.

    It’s possible that you have a custom function that removes the <p> somewhere else. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Fifteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.

    Thanks!

  • James —

    I set up a page that replicates the problem and explains it at the same time. You can access it here.

    Thanks for you help…

  • That would be beyond what can be done with ACF. You’d need to build a new field type using the ACF WYSIWYG editor for a base https://www.advancedcustomfields.com/resources/creating-a-new-field-type/ and then create custom JavaScript for that field type that would do what you want done https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/. Can it be done, probably, but not easily.

    If you don’t want people to edit the field I would actually use a message field where the content of that message field is built using JavaScript that reads the values of the other fields as well as being updated when a change is made to one of the other fields. Still complicated but I think more likely to happen. If you’re interested in this I can point you to some JS that adds custom actions to different types of fields to get you started.

  • Good suggestion, but I don’t want the entire HTML area to be editable and the HTML content would also need to have some additional JavaScript functionality that I don’t think can be added in with the WYSIWYG field. Make sense?

  • Is there any reason why a WYSIWYG field will not work for what you want?

  • Hello, thanks again for this great plugin.
    I appear to have the same problem as described. When setting up a WYSIWYG field, I would like to have the text (html) view tab available to the user. I’ve used ACF for many websites in the past years, but have never seen a tab option like the one you mention above (Visual & Text). When I select WYSIWYG as the filed type, I see the option to have a full/basic toolbar as well as the option to show/hid the media button. But I don’t see an option to show/hide the text tab that is normally available in the wordpress text field. Am I missing something?
    Thanks for your help.

  • Hm, ok, I found a solution in completely turning of wptexturize sitewide with:

    add_filter( 'run_wptexturize', '__return_false' );

    which works but seems a bit heavy handed. In trying to find a way to target the WYSIWYG sub-field more precisely, I found this thread:

    https://support.advancedcustomfields.com/forums/topic/remove-wysiwyg-wptexturize-filter/

    Which suggests:

    remove_filter ('acf_the_content', 'wptexturize');

    Which isn’t working for me, I assume potentially because it is a repeater/subfield?

    I’m also actually accessing the repeater by simply getting the entire repeater as a variable and accessing the text directly via the array, so I’m even more confused that the text is being filtered. (get_sub_field or the_sub_field result in the same curly quotes, however)

  • Hi @johan-dahlbredband2-se,

    Thanks for the post.

    There is actually an ACF add on that offers the ability to customize the WYSIWYG editor styles out of the box.

    Please have a look here: https://wordpress.org/plugins/advanced-custom-fields-custom-wysiwyg-styles/

  • Hi @adser ,

    I am not certain I clearly understand the problem you are having.

    However, you can edit the wysiwyg field’s toolbar items and be able to show only those that you want them to access.

    I hope this helps.

  • Hi @hbroccoli,

    Thanks for the post.

    To customize the acf WYSIWYG settings, you will need to hook into either the wysiwyg_tinymce_settings filter or the wysiwyg_quicktags_settings filter.

    For more info on adding custom JS to fields, please refer to this topic: https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/

  • Hi @tomtids,

    Thanks for the post.

    There are various plugins in the WP repository that can offer this functionality out if the box.

    You can have a look at the following plugin for instance: https://wordpress.org/plugins/advanced-custom-fields-custom-wysiwyg-styles/

  • Hi @auroric-designs ,

    Thanks for the post.

    Unfortunately ACF shortcodes cannot be used within other shortcodes.

    The API expects the shortcodes to be called from within the WYSIWYG editor and will only work for simple text based values.

  • Hi @dallasashleyandmalone-com,

    Thanks for the post.

    Yes this is possible, you will only need to fetch the_content from the wp editor and pass this value to the acf wysiwyg before the value is loaded by hooking into the acf/load_field filter.

  • Hi @dfoley23,

    Thanks for the post.

    The description is not very clear, are you referring to the WP editor being hidden or the ACF wysiwyg editor.

    The issue might have something to do with how you have set up your location rules, please ensure if you are using a set of location rules to map your fields groups, the appearance of all the templates is covered.

    You can also check whether the editor is hidden under the screen options at the top of the page.

  • sweet, however the issue is actually the_flexible_field(),
    get_row_layout() is not finding the layout. i have tried getting ‘repeat_content’ and ‘content_columns’ but neither is working

    <?php
    
        while(the_flexible_field('flexible_content')): 
          echo '<h2>flexi heading</h2>';
          switch (get_row_layout()):
    	 
    	  case 'repeat_content':
    	    echo '<h2>heading</h2>';
    		  if (function_exists('repeat_content')):
    		       content_columns();
    		    else:
    		      echo 'content col is not enabled';
    		  endif;
    	  break;
    	  case 'includes':
    		  if (function_exists('ml_acf_include')): 
    		      ml_acf_include();
    		    else:
    		      echo 'includes is not enabled';
    		    endif;
    	  break;
    	endswitch;
        endwhile; 
    

    heres the output of flexible_content

    Array
    (
        [ID] => 0
        [key] => field_flex_key
        [label] => flexible content
        [name] => flexible_content
        [prefix] => 
        [type] => flexible_content
        [value] => 
        [menu_order] => 0
        [instructions] => 
        [required] => 0
        [id] => 
        [class] => 
        [conditional_logic] => 0
        [parent] => group_56ff5b11d1775
        [wrapper] => Array
            (
                [width] => 
                [class] => 
                [id] => 
            )
    
        [_name] => flexible_content
        [_input] => 
        [_valid] => 1
        [button_label] => Add Component
        [min] => 
        [max] => 
        [layouts] => Array
            (
                [0] => Array
                    (
                        [key] => layout_key
                        [name] => layouts
                        [label] => Components
                        [display] => block
                        [sub_fields] => Array
                            (
                                [0] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57032097d3ac0
                                        [label] => Content Columns
                                        [name] => content_columns
                                        [prefix] => 
                                        [type] => tab
                                        [value] => 
                                        [menu_order] => 0
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => content_columns
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [placement] => top
                                        [endpoint] => 0
                                    )
    
                                [1] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_repeatable_key
                                        [label] => Repeatable image with optional link
                                        [name] => repeat_content
                                        [prefix] => 
                                        [type] => repeater
                                        [value] => 
                                        [menu_order] => 1
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => repeat_content
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [row_min] => 0
                                        [row_limit] => 
                                        [layout] => table
                                        [button_label] => Add Component
                                        [sub_fields] => Array
                                            (
                                                [0] => Array
                                                    (
                                                        [ID] => 0
                                                        [key] => field_56a749bdc0553
                                                        [label] => Content Column
                                                        [name] => text_area
                                                        [prefix] => 
                                                        [type] => wysiwyg
                                                        [value] => 
                                                        [menu_order] => 0
                                                        [instructions] => 
                                                        [required] => 0
                                                        [id] => 
                                                        [class] => 
                                                        [conditional_logic] => 0
                                                        [parent] => field_repeatable_key
                                                        [wrapper] => Array
                                                            (
                                                                [width] => 
                                                                [class] => 
                                                                [id] => 
                                                            )
    
                                                        [_name] => text_area
                                                        [_input] => 
                                                        [_valid] => 1
                                                        [default_value] => 
                                                        [tabs] => all
                                                        [toolbar] => full
                                                        [media_upload] => 1
                                                    )
    
                                            )
    
                                        [min] => 0
                                        [max] => 0
                                        [collapsed] => 
                                    )
    
                                [2] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_styling_tab
                                        [label] => Row Styling
                                        [name] => row_styling
                                        [prefix] => 
                                        [type] => tab
                                        [value] => 
                                        [menu_order] => 2
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => row_styling
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [placement] => top
                                        [endpoint] => 0
                                    )
    
                                [3] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_570320bbd3ac1
                                        [label] => row class
                                        [name] => row_class
                                        [prefix] => 
                                        [type] => text
                                        [value] => 
                                        [menu_order] => 3
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => row_class
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [default_value] => 
                                        [placeholder] => 
                                        [prepend] => 
                                        [append] => 
                                        [maxlength] => 
                                        [readonly] => 0
                                        [disabled] => 0
                                    )
    
                                [4] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031ca0179ba
                                        [label] => boxed content
                                        [name] => boxed_content
                                        [prefix] => 
                                        [type] => true_false
                                        [value] => 
                                        [menu_order] => 4
                                        [instructions] => the width of the content will be limited to the amount set in the stylesheet code.
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => boxed_content
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [message] => 
                                        [default_value] => 1
                                    )
    
                                [5] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031c64179b9
                                        [label] => invert colors
                                        [name] => invert_colors
                                        [prefix] => 
                                        [type] => true_false
                                        [value] => 
                                        [menu_order] => 5
                                        [instructions] => dark color scheme for this panel instead of a light color scheme
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => invert_colors
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [message] => invert color scheme
                                        [default_value] => 0
                                    )
    
                                [6] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031b1b179b8
                                        [label] => style options
                                        [name] => style_options
                                        [prefix] => 
                                        [type] => select
                                        [value] => 
                                        [menu_order] => 6
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => style_options
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [choices] => Array
                                            (
                                                [None] => None
                                                [option 1] => option 1
                                                [option 2] => option 2
                                            )
    
                                        [default_value] => Array
                                            (
                                            )
    
                                        [allow_null] => 0
                                        [multiple] => 0
                                        [ui] => 0
                                        [ajax] => 0
                                        [placeholder] => 
                                        [disabled] => 0
                                        [readonly] => 0
                                    )
    
                                [7] => Array
                                    (
                                        [ID] => 0
                                        [key] => field_57031afc179b7
                                        [label] => bg_image
                                        [name] => bg_image
                                        [prefix] => 
                                        [type] => image
                                        [value] => 
                                        [menu_order] => 7
                                        [instructions] => 
                                        [required] => 0
                                        [id] => 
                                        [class] => 
                                        [conditional_logic] => 0
                                        [parent] => field_flex_key
                                        [wrapper] => Array
                                            (
                                                [width] => 
                                                [class] => 
                                                [id] => 
                                            )
    
                                        [_name] => bg_image
                                        [_input] => 
                                        [_valid] => 1
                                        [parent_layout] => layout_key
                                        [return_format] => array
                                        [preview_size] => thumbnail
                                        [library] => all
                                        [min_width] => 
                                        [min_height] => 
                                        [min_size] => 
                                        [max_width] => 
                                        [max_height] => 
                                        [max_size] => 
                                        [mime_types] => 
                                    )
    
                            )
    
                        [min] => 
                        [max] => 
                    )
    
            )
    
    )
  • that is not the issue. the row class needs to be outside of the repeater.

    here is what i am trying to replicate with tabs and ‘add local field group’

    <?php
    
    acf_add_local_field_group(array (
    	'key' => 'group_57031a424348c',
    	'title' => 'content_columns',
    	'fields' => array (
    		array (
    			'key' => 'field_57032097d3ac0',
    			'label' => 'Content Columns',
    			'name' => 'content_columns',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'top',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_57031a4b179b3',
    			'label' => 'content columns',
    			'name' => 'content_columns',
    			'type' => 'repeater',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'collapsed' => '',
    			'min' => '',
    			'max' => '',
    			'layout' => 'table',
    			'button_label' => 'Add Content Column',
    			'sub_fields' => array (
    				array (
    					  'key' => 'field_5704f37ef4e95',
    					  'label' => 'text_area',
    					  'name' => 'text_area',
    					  'type' => 'wysiwyg',
    					  'instructions' => '',
    					  'required' => 0,
    					  'conditional_logic' => 0,
    					  'wrapper' => array (
    						  'width' => '',
    						  'class' => '',
    						  'id' => '',
    					  ),
    					  'default_value' => '',
    					  'tabs' => 'all',
    					  'toolbar' => 'full',
    					  'media_upload' => 1,
    				),
    			),
    		),
    		array (
    			'key' => 'field_570320bbd3ac1',
    			'label' => 'Row Styling',
    			'name' => 'row_styling',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'top',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_57031acc179b6',
    			'label' => 'row class',
    			'name' => 'row_class',
    			'type' => 'text',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'prepend' => '',
    			'append' => '',
    			'maxlength' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    	),
    	'location' => array (
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'post',
    			),
    		),
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'page',
    			),
    		),
    	),
    	'menu_order' => 0,
    	'position' => 'normal',
    	'style' => 'default',
    	'label_placement' => 'top',
    	'instruction_placement' => 'label',
    	'hide_on_screen' => '',
    	'active' => 1,
    	'description' => '',
    ));
    
    ?>
    
  • Hi @emanahan,

    Thanks for the post.

    Since the WYSIWYG editor already contains a color palette to choose font colors, it is best advised to make use of this functionality which is accessible from the toolbar.

Viewing 25 results - 651 through 675 (of 1,298 total)