Skip Navigation

[Résolu] Using a view in a content template like a page builder – no posts

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Display a content template with PHP codes.

Solution:

Create a content template(ID: 123), design it with blocks editor, setup the static contents.

<?php echo render_view_template( 123); ?>

Relevant Documentation:

This support ticket is created Il y a 4 années et 2 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 36 réponses, has 3 voix.

Last updated by martinE-4 Il y a 3 années et 11 mois.

Assisted by: Luo Yang.

Auteur
Publications
#1526161

Nothing is fixed/ When I remove my "Fake blank" view block the footer problem returns. Try it on the Education page. hidden link

#1526163

Yes, I did test those URLs you mentioned above in my localhost with your duplicator packages, see the URLs of my above screenshots, I am using below URL to install your duplicator package in my localhost:
hidden link

I did not take out the fake view, only test the URLs, the fake view was already in the content template.

What I see in my locahost is different from yours, isn't it?

For such kind of problem, please provide a live website with the same problem(credentials + FTP access), private message box enabled, thanks

#1526165

hidden link

Here is a live link provided by my LOCAL by Flywheel program. Let me know if you can get in with same user password I already gave in earlier credentials.

#1526473

Thanks for the details, I can log into your test site, please provide below details:
Where do you put the custom PHP codes into?

<?php echo render_view_template( 123); ?>

Which one is the content template for website footer?

#1526491

The content template for the footer blocks is 'Footer Template Blocks' id 3025.

The PHP is in the GeneratePress (GP) element 'Footer Content Template' hooked into the entire site with the GP 'before_footer' hook location.

Thanks Luo

#1526651

I can see the problem after remove the fake view, will update here if there is any found.

#1528215

Here are what I found, there are some JS missing in outputs of function render_view_template(), and it conducts the problem you mentioned above, I need to check it with our developers for it, will update here if there is anything news. And currently, in your case, the fake view is required.

#1528947

Thank you so much Luo for all your help. I look forward to hearing back. I am proceeding with a staging site and if that would help I could give you the url tomorrow.

#1530403

Here is the update:

In that page:
hidden link
There are some JS errors, for example:

Uncaught SyntaxError: Invalid or unexpected token

The problem is in that page, Content template javascript is being changed to something, for example:

		var styleTmp = document.querySelector( '.toolset-blocks-styling-tmp' );</p>
<p>	

There are extra HTML p tag in above JS codes, it break the JS function, and conducts the problem, it should be a compatibility issue, some other plugin/theme is changing JS codes, do you have any clue to duplicate the same problem with a fresh WP installation + GP theme/plugins + Toolset plugins?

#1536049

I have been busy getting the site live at icasc.ca It is up now so I'll work some more on trying to help crack this problem. I will create a fresh site and use minimal plugins and GP theme. I will get back to you soon and perhaps I will be able to send you some news or the duplicator package for the site.

#1536179

Hi Luo. I think the problem is my use of the [wpv-autop] shortcode. When I put it in, I have the javascript error and the problem. When I take it out, the footer view displays fine and the javascript error (EOF ...) goes away! (without any need of inserting the 'fake blank' view fix I invented.)

(I was required to use the [wpv-autop] shortcode on a Types Wysiwyg custom field to fix the other bug of no para breaks in a custom field...]

I hope this helps you and the devs track down the problem. Please let me know if you need anything further from me.

#1536349
Test-Page-1---Test-March-2.png

Further investigation this morning has exposed a 2nd problem with a view interfering with the grid block (it is formatted but appears vertical).

I managed to reproduce this 100% with a SIMPLE fresh site:
using Toolset / and GeneratePress Premium (which has the element hook allowing me to locate my toolset footer content template wherever I wish) - no other plugins except SNIPPETS to put my php code: <?php echo render_view_template( 123); ?>
no custom post types
no content - just 1 page and 1 post

1. Create a new content template in Blocks (using the Views plugin not the Blocks plugin)
2. Content template has only a 3 column GRID block. Put a Toolset Heading block in each grid cell.
No other adjustments to grid.
3. Hook this content template using the php render_view_template code above anywhere below the content (I found it failed anywhere below eg. before_footer, or after_content. If you place it before_content it can show correctly).
4. Create a new page in the Blocks editor using no content template (NONE) and add a simple view which just contains the post title of either pages or posts (or even both pages and posts, it does not matter).
5. The 3 columns fail by showing as 1 under the other (vertical). See uploaded image.

That's it! This is the 2nd problem (100% reproducible).

This may or may not be related to the above [wpv-autop] problem, which I believe is also reproducible.

#1536805

Thanks for the details, I am trying to reproduce the same problem with the steps you mentioned above, will update here if there is anything found

#1536871
GP1.JPG

I have tried the steps you mentioned above a lots of time(with Views plugin or Blocks plugin), but can not duplicate the same problem, see screemshot: gp1.JPG

The grid block in footer works just fine.

If there are not detail steps to duplicate the same problem, it will be taken as an exception.

Can you provide a duplictor package with a fresh wordpress installation and the steps you mentioned above?
Private message box enabled again. Thanks

#1540259

Thanks for the details, I am checking it, will update here if there is anything found.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.