Support

Account

Forum Replies Created

  • Just a note that the ‘Shortcode Extended’ plugin does seem to still be working for me after updating to ACF v6.1.7 and WP v6.2.2. The plugin ‘seems’ pretty simple and safe, only applying to blocks you specify that include ACF shortcode. So hoping this will continue to work well as we rebuild a site that needed it. It seems like the simplest and most ‘WordPress native’ solution that we tried.

    For our use, we just enabled it on a Custom HTML block. We wouldn’t use those often, and it allowed very precise formatting. So we made the fields we needed to display into a Definition List, with the field label being the DT and field value being the DD. Seems most semantically correct and allows easy formatting.

  • After trying a few different solutions to adding ACF fields in a default WP Query Loop, I just found this solution. It seems very simple, and does appear to work fine in my intended use. I have it working on a HTML Block, so I can do whatever formatting is required.

    – Anyone know what potential issues this solution might cause in the future?

    It seems like it’s just replacing ‘wpautop’ with ‘do_shortcode’ on certain blocks that you enable. Just not sure of any potential cons to this approach. Just seems almost ‘too simple to be true’…

  • Thanks for the continued help, much appreciated!

    I think I was able to get it working by altering the code to display the gallery in my template file. Instead of using:
    echo do_shortcode('[gallery orderby="menu_order" link="none" size="large" columns="1"]')

    I’m now using:

    <?php if ( '' !== ( $gallery = get_post_meta( get_the_ID(), 'project_gallery', true ) ) ) : ?>
                    <section class="project-gallery"> 
    		<?php echo do_shortcode( $gallery ); ?>
                    </section>
                <?php endif; ?>
    

    The ‘if’ statement was already wrapping my original code, I just wasn’t taking advantage of it properly. Someone else had started this plugin for us, and I was just trying to get it working (with my limited PHP knowledge).

    It now functions just like a gallery added to the main content area, so we do have to make sure all variables are accounted for there (e.g, link=none, size=large, etc.). But this is fine.

  • Hi. We are using ACF 4.4.11 on WP 4.7.3. Now we do also use TinyMCE Advanced as our editor (have been for years), but it’s usually compatible with things.

    In Admin, we add galleries in standard WP fashion, using ‘Add Media’ button and media interface. I can’t see the actual shortcode in the WYSIWYG editor, as there is no ‘Visual/Text’ tab, but when I copy/paste it into the main content area and examine, the shortcode looks perfectly fine.

    As a test, I manually added the desired photo IDs to the ‘do_shortcode’ statement in the template file, and that did cause it to only show those specific photos. But it still didn’t follow the order properly. So there must be something unique in how the WP gallery shortcode is parsed in the standard content field.

  • OK, thanks. Yeah, we prefer to stick with default WP functionality wherever possible (less dependencies or possible conflicts with updates), so was hoping something this basic would work OK.

    But I’m guessing we’re probably not going about displaying the gallery properly (I’m a def PHP novice). As we obviously can’t specify ID’s to include in the ‘echo do_shortcode’ statement, it’s appearing that it won’t by default respect what is done in the Admin editor (where it IS correct).

    When I add the same gallery code to the default post content field, the gallery DOES display as expected (only showing selected images, and in order specified). We were going to use that for other purposes, but maybe I can just re-arrange how and where things are added. The end-user would then just need to be on-top of the variables (e.g., large images, link to ‘none’, etc.).

    I’m sure there must be a way to get the same functionality from the ACF WYSIWYG field as from the default content field, just not sure how exactly to go about it…

Viewing 5 posts - 1 through 5 (of 5 total)