Skip Navigation

[Resolved] Error adding a shortcode block around a conditional template block.

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by matthiasV-2 3 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2099221

**Please refer this ticket to Waqar**

Waqar,

1. Following the instructions from MemberMouse below:
hidden link

We've added a shortcode block around (above & below) the conditional block in the Toolset properties template. We get "multiple" error messages:

"This block contains unexpected or invalid content".

2. Also we are assuming that the "content restriction" will apply to every single post within the custom post type? So 1 edit in the Toolset properties template will be pushed to "all" property posts "automatically", right?

We're using our test site hidden link, but persumably the same issue occurs on our production site hidden link as well.

I've sent a screen recording video to Nigel again.

#2101045

Hi,

It is important to remember that the shortcode block from WordPress is designed to process only simple shortcodes.

When you have to place shortcodes with a complex structure and HTML code combination, you should use either the simple custom HTML block or the Fields and Text block.
( In the video from the MemberMouse support, the support agent has also used the HTML block and not the shortcode block )

The supporter suggests that you'll include the opening shortcode tag ( e.g. MM_Member_Decision purchasedProduct='2|7|8|9|10|11|12|13'] ) from MemberMouse, in one HTML block above the content. And then the closing shortcode tag ( [/MM_Member_Decision] ) will need to be placed in another HTML block below the content.

But in your template (on the test site), there was a shortcode block with the opening tag:


[MM_Member_Decision purchasedProduct='2|7|8|9|10|11|12|13']

Then there were your content blocks and below them was another shortcode block, which should have had the closing tag [/MM_Member_Decision], but instead, it had a new tag code along with custom HTML and CSS code:


[MM_Member_Decision purchasedProduct='!(2|7|8|9|10|11|12|13)']

Beste [MM_Member_Data name='firstName'],

Deze informatie is exclusief voorbehouden voor klanten met een "contact" abonnement.



<style>
a:link, a:visited {
  background-color: #111111;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

a:hover, a:active {
  background-color: #2D4F6C;
}
</style>



<a href="<em><u>hidden link</u></em>" target="_blank" rel="noopener">Krijg toegang</a>





[/MM_Member_Decision]

This incorrect usage resulted in the errors shown on the template about the unexpected content in the blocks on the template.

I have removed all the content from the shortcode block below the Fields and Text block that contains the text "Vragen of interesse? Neem contact" and only included the closing tag [/MM_Member_Decision] and the errors about the unexpected content are fixed.

You'll see that the content template is now editable and saveable again.

Using the same pattern, you can add more blocks with the MemberMouse conditional shortcodes tag. To summarize again, each conditional section, in this case, would consist of these 3 elements.

a. An HTML block with only the opening tag like "[MM_Member_Decision purchasedProduct='2|7|8|9|10|11|12|13']"

b. Then all the blocks with the content that you want to show conditionally to members or non-members.

c. An HTML block that will only hold the closing tag "[/MM_Member_Decision]".

I hope this explanation will help.

Your understanding of the point number 2 is correct. All changes made to the content template properties would reflect on all the single properties post pages.

regards,
Waqar

#2101981

My issue is resolved now. Thank you Waqar!