Skip Navigation

[Resolved] Blocks in Content Template not working – forced return to Classic Editor

This thread is resolved. Here is a description of the problem and solution.

Problem:

Field and Text block - selecting text in the HTML side difficult (have to be careful or it pops suddenly to select text on several blocks either side of it, above and below) - also the block expands to take up more than 1 page vertical when editing HTML

Solution:

It seems to be a browser cache problem, clear browser cache or try with anoter browser, and test again.

Relevant Documentation:

This support ticket is created 4 years, 9 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/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by martinE-4 4 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1491393

Here are some of the difficulties which have forced me back to the Classic editor pending fixes. Please forward to devs (I do appreciate everything that is being done in Blocks but for me I am wasting a lot of precious development time trying to make it work).

1. Field and Text block - selecting text in the HTML side difficult (have to be careful or it pops suddenly to select text on several blocks either side of it, above and below) - also the block expands to take up more than 1 page vertical when editing HTML?

2. Clicking on a Field and Text block has a quirky way of scrolling the screen window up and out of sight

3. Some of my Fields and Text blocks just stopped displaying in the front end. Blocks that used to work suddenly stop displaying in the front end.

4. Better to use shortcode block than html Field and Text block due to this quirkiness.

5. When I copy / pasted my blocks code into a classic content template everything was fine. Although I had been having trouble making things work in the blocks editor so I had removed a few of my shortcode endings [/types] - This seemed to improve things in the blocks editor with my conditionals but the classic editor made me put them back in.

Here is a copy of my content template code FYI which I had to meticulously copy/paste into the classic editor. I guess sadly I will have to stick to classic until the bugs are worked out of blocks. Please let me know when these things are solved.

<h2>[wpv-post-title]</h2>
[wpv-conditional if="( '[is-local][types field='common_featured_media' output='raw'  ][/types][/is-local]' eq '0' )" ]<p class="embedded-video">[types field='common_featured_media'][/types]</p>[/wpv-conditional]

[wpv-conditional if="( '[is-local][types field='common_featured_media' output='raw' ][/types][/is-local]' eq '1' )" ]<p class="embedded-video"><img src="[types field='common_featured_media' output='raw' ][/types]"></p>[/wpv-conditional]

<p><span class="resource-label">Resource Type:&nbsp;</span> [wpv-post-taxonomy type="resource-type"]</p>

<p>[wpv-conditional if="( $(wpcf-resource_author) ne '' )"  ]<span class="resource-label">Author:&nbsp;</span> [types field='resource_author' separator=', ' ][/types][/wpv-conditional]</p>

<p>[wpv-conditional if="( $(wpcf-resource_date_published) ne '' )"]<span class="resource-label">Date Published:&nbsp;</span> [types field='resource_date_published' ][/types][/wpv-conditional]</p>

<p>[wpv-conditional if="( $(wpcf-resource_published_in) ne '' )"]<span class="resource-label">Published In:&nbsp;</span> [types field='resource_published_in' ][/types]&nbsp;[/wpv-conditional]</p>

[wpv-autop][types field='resource_description'][/types][/wpv-autop]

[wpv-conditional if="( '[count_instances field= 'wpcf-field_resource_link_title' ]'  =  '1' )" ]<p style="margin: 0; padding: 0"><span class="resource-label">Resource:&nbsp;</span></p>[/wpv-conditional]

[wpv-conditional if="(  '[count_instances field= 'wpcf-field_resource_link_title' ]'  >  '1'  )"]<p style="margin: 0; padding: 0"><span class="resource-label">Resources:&nbsp;</span></p>[/wpv-conditional]

[wpv-for-each field="wpcf-field_resource_link_url"]
<p style="margin: 0; padding: 0">
<a href="[types field='field_resource_link_url'  output=' raw'][/types] " target="_blank" rel="noopener noreferrer">[types field='field_resource_link_title'][/types]</a>
</p>
[/wpv-for-each]

[wpv-conditional if="( '[count_instances field= 'wpcf-resource_attachment' ]'  >  '1' )" ]<p style="margin: 0; padding: 0; clear: both;"><span class="resource-label">Attachments:&nbsp;</span></p>[/wpv-conditional]
[wpv-conditional if="( '[count_instances field= 'wpcf-resource_attachment' ]'  =  '1'     )" ]<p style="margin: 0; padding: 0; clear: both;"><span class="resource-label">Attachment:&nbsp;</span></p>[/wpv-conditional]

[wpv-conditional if="( $(wpcf-resource_attachment) ne '' )"][types field='resource_attachment' separator='<br> '][/types]
[/wpv-conditional]

[wpv-conditional if="('[wpv-post-taxonomy type='related' format='slug' ]' ne '' )"]
[wpv-view name="related-resources-by-taxonomy" view_display="layout" limit="8" wpvrelated="[wpv-post-taxonomy type="related" format="name"]" ]
[/wpv-conditional]

<span class="resource-label">Related Resources:&nbsp;</span><br>[wpv-view name="related-results-with-grid"]

[toolset-edit-post-link content_template_slug='related-resources' target='self']Edit: %%POST_TITLE%%[/toolset-edit-post-link]
#1491745

Hello,

Q1) Field and Text block - selecting text in the HTML side difficult ...
I have tried it in my localhost with a fresh WordPress installation, there aren't the problems you mentioned above.
Please try these:
1)In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again
2) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

Q2) Clicking on a Field and Text block has a quirky way of scrolling the screen window up and out of sight
Same as above, please check the compatibility issue.

Q3) Some of my Fields and Text blocks just stopped displaying in the front end. Blocks that used to work suddenly stop displaying in the front end.
I have tried the codes you mentioned in Q5, it seems the problem is Comparison operator ">" has been changed into HTML encode: "&gt ;" in the of HTML editor of "Field and Text" block, for example:

[wpv-conditional if="( '[count_instances field= 'wpcf-resource_attachment' ]'  >  '1' )" ]<p style="margin: 0; padding: 0; clear: both;"><span class="resource-label">Attachments: </span></p>[/wpv-conditional]

After save above codes in HTML editor of "Field and Text" block, it is changed to be:

[wpv-conditional if="( '[count_instances field= 'wpcf-resource_attachment' ]' &gt ;  '1' )" ]<p style="margin: 0; padding: 0; clear: both;"><span class="resource-label">Attachments: </span></p>[/wpv-conditional]

Can you confirm it is the same problem of your website?

Q4) Yes, currently, you can try with shortcode block or "content template" block

Q5) See the answer of Q3)

#1495193

Quitting the browser, restarting the computer and trying again today, everything seems fine again with the Blocks editor. I restored the content template made with the blocks editor and it seems to be fine. Can't see any problems today.

Update: actually I've had to go back to my classic template again. The conditions aren't working when I have an embedded video showing ie. shortcode [islocal] = 0 and then I don't see my author field or resource types (both Field and Text blocks). I guess my situation is too complicated for Blocks.

My issue is not quite resolved now. Thank you! Seems to be problems with code in the blocks. I can't see it. Looks fine same as what I pasted to classic.