• Resolved Babak Fakhamzadeh

    (@mastababa)


    I add an ACF markdown field. If I set the field to be ‘required’, when submitting a form with the field, WordPress tells me the field is empty, even when it’s not.

    In the frontend, rendering the contents of the field, shows nothing.

    Perhaps relevant, because I do not want the main contents of the post type in question to use Markdown, I do this:

    remove_post_type_support(‘partner’, ‘markup_markdown’);

    So, how can I use an ACF markdown field, while not changing the main contents field to a markdown field, as well?

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    My apologies for the late reply @mastababa ?? After testing on my local I guess I understand what you are trying to achieve. It’s actually a setting related bug introduced in version 3, you shouldn’t be possible at all to get markdown support for custom field only.

    From what I understand now it makes sense, I need to update a few rules within the framework. Kind of. If you haven’t given up yet and can wait a few more days, I’ll do my best to make a release later this week so you can disable markdown with custom post type while keeping markdown for custom fields.

    Thank you for your patience ??

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    That would be awesome! ??

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    Poke @mastababa Thank you for your patience ??

    I’ve just released version 3.2.0 that should fix a few existing bugs as well as cover your use case. Please remember ACF has started sanitizing HTML fields since 6.2.5 so if iframes or other elements are missing, instead of using the standard way to output the value of your custom field as below :

    the_field( 'my_custom_field' );

    you can try with the following fallback – at your own risk ?? :

    echo mmd()->markdown2html( get_field( 'my_custom_field' ) );

    Please refer to the official documentation to adjust with your case :
    https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/

    I haven’t tested with all the builder on the markets, on my local machine a custom post type with a few “ACF Markup Markdown” custom fields are working properly with the Classic Editor / Gutenberg Editor when setup with the remove_post_type_support function as you did.

    The only caveat I found is the fullscreen or side panel feature won’t be usable at all with those fields (overlapped area depending from the setup, etc…) so I guess I will have to disable the buttons and keep only the preview button for custom fields.

    It was a bit harder than I expected, I put some good vibes so I really hope it will work for you.

    Kind regards,

    Peter

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    Bump I’ve just released v3.2.2, indeed sometimes the custom field value wasn’t saved properly. Should be good now.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Many thanks for the work! I very much appreciate it.

    Buuuuuuut, though I get this to work in the backend, when using an ACF form in the frontend, the field in question is overlaid with a spinner-icon, which never goes away.

    So, perhaps, a relevant javascript file is not loaded when calling the field in the frontend?

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    Poke @mastababa,

    Not sure it was working properly on my side – at least with the Firefox browser – just in case I tweaked the css selectors, added a js trigger to refresh the view after the first load, and bumped the assets’ version. A quick test with the Brave browser was successful.

    So please upgrade to the latest version 3.2.4, clear your cache please and give it a new try when you can, I hope this time it’s gonna work ??

    Peter

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thanks for the work. But I’m still having the same problem, on Brave, Firefox, and Safari ??

    I’ll see if I can get around to a test using alternate themes.

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    @mastababa Sad to hear about that… In short the spin loader is removed when the editor is fully loaded. A custom javascript event called CodeMirrorSpellCheckerReady is sent when spell checkers are ready – even if not enabled – that should trigger the update of the user interface (Disabling loaders, enabling stickies, etc…)

    Something is wrong within my plugin or one of your plugin / custom code is interfering with the loading. I released a tiny update 3.2.5 to force the launch of the user interface when spell checking is disabled. So I would recommend to try it too ?? After upgrading to 3.2.5 :

    1. Please go to the Markup Markdown settings page :
      /wp-admin/options-general.php?page=markup-markdown-admin
    2. Then click the “Screen Options” link or button at the top
    3. Uncheck the “Hung Spell Checker” checkbox
    4. Don’t forget to click the Apply button to save your settings

    You are done ! The spell checker addon should have been completely disabled and the “Spell Checker (Experimental)” tab should not be displayed anymore. If you go back to the edit screen of your post it should be better. I hope.

    – – –

    On my side I only tested with Gutenberg (The block editor) with one and multiple custom custom fields. If you are using a different editor (Elementor, Divi, etc…) or a completely different setup that would be hard for me to reproduce your issue. Here you are on your own, if you need assistance (business support), I would recommend to reach me through my form here :
    https://www.markup-markdown.com/contact/

    Kind Regards,

    Peter

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thanks. The spell checker was not turned on for me.

    Still no difference, though. I don’t use any third party editors, but perhaps I need to reiterate that I’m having the problem in the front-end, when including an ACF form.

    You want me to include a video recording of the problem?

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    @mastababa I got it, you meant acf_form_head / acf_form ?

    To resume nothing is supposed to work as I only loaded the assets for the backend. That was the original design, so even if you delete the spinner / wrapping layer, the markdown editor is not there… ??

    I’ll do my best to release a new version soon because a few bugs needed to be patched. The next release will support basic markdown input with ACF on the frontend. By basic I mean I disable the media manager, and the fullscreen / preview feature as it didn’t work properly most of the cases on the frontend even with the basic theme. ?? (conflicts, error, etc…)

    Please wait a few more days, next time that should rocks ! ! ??

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Correct. I realise that this is not the original issue I posted above. In my defence, the latter was my objective all along ??

    No worries. Take your time. I fully understand the hassle this implies. Much appreciated ??

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    ?? @mastababa

    Please give a new try with the latest version, this time it should be much much better. ?? One point: from what I understand, the ACF edit form is by default available for the guest user ????? I added a new method to check for an existing logged user with the edit_posts capabilities:

    <?php
      $user_granted = function_exists( 'mmd' ) && mmd()->user_allowed() ? true : false;
      if ( $granted ) :
        acf_form_head();
      endif;
      get_header();
      ...
      if ( $user_granted ) :
        acf_form();
      endif;

    Might help, especially for staging env. that can be accessible from outside.

    Disclaimer 1: For the css / js to be loaded properly, you need wp_head (often triggered by get_header) and wp_footer (often triggered by get_footer) in your target template. Make sure there are present.

    Disclaimer 2: As you are working in the frontend, watch out for any optimization code that could break the queue (concatenation, a jquery version replacement, a polyfill or other core asset deregistered, etc…) My hardest times were actually results from my own custom code in my various testing themes that was breaking the loading… ??

    Kind Regards,

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thanks Pierre-Henri,

    Progress! I now got this to work in the frontend. Though the visualisation of the button bar is messy.

    https://i.postimg.cc/43mR6HHC/Screenshot-2024-05-02-at-11-17-18.png

    However, more problematic is this: I’m using this field for a taxonomy term, and in the backend, the editor now does *not* load. I get the spinner icon that never disappears.

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    @mastababa it’s a great news we are getting closer ! ??

    Yes I haven’t checked in details but from my tests a few styles on the frontend are probably overrides / conflicted with your theme. ?? Gonna think later on how to upgrade that.

    About the taxonomy that’s not good, you mean the ACF Markup Markdown do not load anymore ? Or the taxonomy content ? Another user reported a similar issue as well. ?? If you can tell me a little more please, that would be really helpful.

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    @mastababa How do you do ? Good news I’ve just released version 3.4.0 that should solve your issues ?? I hope so ??

    In case it wouldn’t work, could you share with me more information please ?
    Backend, frontend, version, theme if possible, etc… any information that could help me reproduce your issue on my local.

    I appreciate your time and your patience ??

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘ACF markdown field doesn’t work’ is closed to new replies.