Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACF, dynamic field in Shortcode element does not work #5214

Closed
5 tasks done
seanvandermolen opened this issue Jul 25, 2018 · 4 comments
Closed
5 tasks done

ACF, dynamic field in Shortcode element does not work #5214

seanvandermolen opened this issue Jul 25, 2018 · 4 comments
Labels
status/merged Indicates when a Pull Request has been merged to a Release.

Comments

@seanvandermolen
Copy link

seanvandermolen commented Jul 25, 2018

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest stable version of Elementor.

Description

I have a single template in which I'm using ACF fields to populate data. One is a shortcode for an Image Grid that is custom to each post. The ACF field is a text field, which I place the shortcode in.

This partially works as it inserts the shortcode for the first post. But it does not seem to grab the correct shortcode in each post. On each page, it's the first posts shortcode.

Steps to reproduce

Use CPT UI to create a post type
Use ACF and assign a custom text field to hold the shortcode text
Create a single page template and insert the shortcode element. Assign the custom field as the dynamic content.

The shortcode will be the code of the first post made for each post, instead of the shortcode entered in the in each post

I also created a fresh install and tried using shortcode element and a dynamic custom field as the shortcode source. It straight up doesn't work at all. Which means there is some element on the first site I ran into this problem on that is cached. I think it was an advanced fallback field that I filled and then deleted... that is still populating the grid on all the tour pages

Whats interesting is that using the shortcode element does not work. But in this demo page, using the shortcode in a text box does work. So I think I found a workaround while troubleshooting the issue, but this is still a problem I think.

http://wp1.wpmanagementservice.com/tours/tour-page-2/

Isolating the problem

  • This bug happens with only Elementor plugin active (and Elementor Pro).
    Can't disable Woocommerce Since one of my ACF fields requires it
  • This bug happens with a default WordPress theme active.
    Can't test the issue without
  • I can reproduce this bug consistently using the steps above.

Environment

== Server Environment ==
Operating System: Linux
Software: nginx/1.15.1
MySQL version: 5.5.5
PHP Version: 7.2.8
PHP Max Input Vars: 1000
PHP Max Post Size: 256M
GD Installed: Yes
ZIP Installed: Yes
Write Permissions: All right
Elementor Library: Connected

== WordPress Environment ==
Version: 4.9.7
Site URL: http://wp1.wpmanagementservice.com
Home URL: http://wp1.wpmanagementservice.com
WP Multisite: No
Max Upload Size: 256 MB
Memory limit: 256M
Permalink Structure: /%year%/%monthnum%/%day%/%postname%/
Language: en-US
Timezone: 0
Debug Mode: Inactive

== Theme ==
Name: Twenty Seventeen
Version: 1.6
Author: the WordPress team
Child Theme: No

== User ==
Role: administrator
WP Profile lang: en_US
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

== Active Plugins ==
Advanced Custom Fields
Version: 4.4.12
Author: Elliot Condon

Custom Post Type UI
	Version: 1.5.8
	Author: WebDevStudios

Elementor
	Version: 2.1.4
	Author: Elementor.com

Elementor Pro
	Version: 2.0.16
	Author: Elementor.com

The Grid
	Version: 2.6.60
	Author: Themeone

== Debug ==
Errors:
TypeError: Cannot read property 'attributes' of undefined
at http://wp1.wpmanagementservice.com/wp-content/plugins/elementor/assets/js/frontend.min.js?ver=2.1.4 - 2:7460
2018-07-25 18:03 +00:00
x 4 times

@seanvandermolen
Copy link
Author

Using the text element to display the grid did not work on my original development site. It could' find the grid and it looked like the name had been altered somehow. So what I'm entering enter the custom field is somehow being rewritten and no longer works.

I can create a test page and use the same element with the same shortcodes and it works just fine. It's just the combination of ACF and the elements that fail.

@seanvandermolen
Copy link
Author

And now I suspect this is the issue
https://support.advancedcustomfields.com/forums/topic/smart-quotes/

@seanvandermolen
Copy link
Author

If the shortcode has a space in it [the_grid name="Easter Week"] | No grid was found for: "Easter.
If I remove the space in the shortcode I still get [the_grid name="RRR"] | No grid was found for: "RRR".

@bainternet
Copy link
Contributor

The issue was in the render method,
Should be fixed in next version,

thanks.

@bainternet bainternet added status/has-pr Indicates that an Issue, or Discussion has a companion Pull Request awaiting to be merged. status/merged Indicates when a Pull Request has been merged to a Release. and removed status/has-pr Indicates that an Issue, or Discussion has a companion Pull Request awaiting to be merged. labels Jul 26, 2018
KingYes added a commit that referenced this issue Jul 26, 2018
Shortcode widget: Fixed dynamic tags support, fixes #5214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/merged Indicates when a Pull Request has been merged to a Release.
Projects
None yet
Development

No branches or pull requests

2 participants