Shortcodes working in standard posts but not Pro Elements

Dear Themeco,

I’m having trouble getting shortcodes from Post Table Pro to work in V2 content element or classic raw content.

The same shortcakes are working fine in a normal post - just not on a Pro built page.

This is the code I’m trying to use on a Pro page:

[posts_table columns=“title, cf:wpcf-doclink” post_type=“document” ]

It seems like it’s trying to populate the content but shows up blank.

Any ideas?

Many thanks,

  • Chris

Hi Chris,

Would you mind sharing the URL of the page where you have added it but not working? In case you think a wordpress credentials is needed, please share it on a secure note.

For the meantime, let’s do basic troubleshooting. You could try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

Let us know how it goes!

Thanks for the help Lely,

Hi Lely,

Thanks for the help.

The site is bonforwork.com

You will need to log in with a password. I’ll put it in a secure note.

The plugin is actually working I discovered - but it’s not showing in the Pro preview. Is that something I should probably accept or is there a way to get it working in the preview as well?

Here is a sample page: https://bonforwork.com/test2/?preview_id=1478&preview_nonce=8bb1336f5c&_thumbnail_id=-1&preview=true

Thanks,

  • Chris

Hello Chris,

Thank you for providing the information. I have inspected your site and the first thing I noticed is that you inserted an invalid JS line in the custom JS section. You are not supposed to insert this:

<script src="https://use.fontawesome.com/71692bf11c.js"></script>

Because the custom js is already wrapped with a <script> tag, I have changed it to this:

/* you must add JS script here */



/* Please keep this line always at the bottom of all your JS code */
</script><script src="https://use.fontawesome.com/71692bf11c.js">

The format should look like that so that it will always become valid when displayed on the front end.

Now, regarding the shortcode on why it is not displaying in the Content editor preview. We all know that the shortcode works perfectly on the front end. We can check it here: https://bonforwork.com/test2/

The problem is that this shortcode runs with JS script to display and format the table. The content editor prevents any custom JS from working to avoid any conflicts. This is the reason why it is not showing in the preview yet it displays on the live page. Only shortcodes with static output will be display in the preview. Any shortcode that outputs dynamic content may not display correct in the Content editor.

Hope this explains it.

1 Like

That’s clear. Thank you.

You are welcome!

This doesn’t quite resolve the issue of how to insert third party plug-in shortcodes into pages with Pro.

I’m having similar issues with Paid Memberships Pro (PMP) add-on. The shortcodes for PMP will ONLY work in Pro when I use the “Classic Raw Content” element.

Is the current “best practice” for adding third party shortcodes to use the “Classic” element? Or is there a new element that we should use in Pro to handle these?

Thanks again,
Joe

1 Like

Generally, shortcodes will work in the new Text element as well as the Classic Text and Raw elements. But, some shortcodes will not work mostly because of what they add to the page like scripts. If your shortcode works only in the Raw element, then you should use that one. That is even better because the Raw element simply wraps the content with a div with a class of x-raw-content while the Text elements add auto paragraphs to the content.

Thanks.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.