** This example is using the view named: OVERNATNING but is the same on all views **
I am trying to:
I have a few custom shortcodes in my Loop Item template. They all work fine, but when I try to add this one, for some reason it breaks my loops. I have deleted all of the functionality in my shortcode to test it, so my shortcode is just the following.
function get_primary_cat() {
return 'test';
}
If you remove the shortcode from line 27, the loop items all work fine!
Link to a page where the issue can be seen:
hidden link
hidden link
The Edit View page:
hidden link
I expected to see:
The post titles and data to come through for each post. It works for some, not for others?
Instead, I got:
It seems to be using the page's title instead and the listing data is missing?
Okay I see that there is quite a lot of complex content in this Content Template. Let's try to narrow down the issue. Please duplicate the current Content Template from Toolset > Content Templates, to keep as a backup. Then edit the current Content Template so that only this code remains:
[wpv-post-title]<br />
[get_primary_cat], [wpv-post-field name="phone"]
Then test the page again. If the phone numbers do not appear as expected, then we can be fairly sure the rest of the template is not causing a conflict. Please let me know the results. If you need to replace the original content from the duplicate content template that's fine.
Hi Christian,
You're right - this seems to work fine when it's stripped to just:
[wpv-post-title]<br />
[get_primary_cat], [wpv-post-field name="phone"]
I'm not sure what's going on, or why adding this one line would break the loop. 🙁
It is a complicated view, but otherwise works beautifully until I add that shortcode, even though it's not really doing anything other than returning 'test'.
Thanks for looking at it - I'm really stuck 🙁
Hi Christian,
It works perfectly fine, if I take the <div class="business-actions"> section out or if I take the <div class="listing-actions"> out!?
I don't suppose the loop content is too long or something?
Okay here is an explanation of what I think is happening, assuming there are no other errors in your Content Template:
https://toolset.com/forums/topic/conflict-with-php7-and-avada-theme/page/2/#post-595850
Basically there is a problem with conditionals that contain a large amount of content, and it has become evident in some versions of PHP 7. There are a few options here, in order of ease of implementation:
1. Simplify your conditionals so the amount of content in any one conditional tag is much smaller. This may mean reorganizing code to use multiple content templates, or creating custom shortcodes to break up large amounts of content into smaller chunks.
2. Edit your site's php.ini file (this may have to be done by your host company) to include the line
This may bypass the issue in PHP 7, as described here: https://stackoverflow.com/questions/39685883/php-preg-jit-stacklimit-error-inefficient-regex
3. Downgrade to PHP 5.6
Let me know your thoughts and we can go from there.
Gotcha, okay - thanks Christian! I've split a block of the content out into another template and then included that & it works perfectly.
That's probably a better way for me to do it anyway, considering the number of view pages that I will have, I can share some content between them instead.
Thanks so much for your help - I'm glad I wasn't going completely mad (yet) 🙂