-
AuthorPosts
-
July 5, 2019 at 8:06 pm #1116076
In response to https://kriesi.at/support/topic/which-function-is-responsible-to-display-the_content/#post-1116057 Yes, the posts I’m trying to query were built with the Advanced Layout Editor. I’m including credentials for the staging site, so you can have at it ;) . And the below is copied from my post in the previous thread — thanks!
I’m trying to call post content using the_content() in my Search & Filter Pro queries on http://cb0.a81.mwp.accessdomain.com/services/property-management/properties/ and the listings are coming up blank (see https://screencast.com/t/Uuq2R5fVt ), but only in conjunction with using the ajax to show the results. So, on first page load, the listings show, but when you select a different Property Type or Geographic Region, you can see the results are queried — the number of results is correct — but the_content() is blank. If you then refresh the page, the listings show again. I’ve spoken with S&F Pro support and they say it’s the the_content(); line that’s failing. Do you have any suggestions for a fix? Thanks and lmk if you have any questions or if I should start a new topic.
July 8, 2019 at 5:58 am #1116568Hey sky19er,
Thank you for using Enfold.
The pages/posts created with the advance layout builder are going to use the “template-builder.php” file to render the content. You can’t use the default the_content or get_content function for those pages. You have to fetch the custom field named “aviaLayoutBuilderCleanData”, which holds the ALB shortcodes.
/** * Filter the content for content builder elements */ $content = apply_filters( 'avia_builder_precompile', get_post_meta( get_the_ID(), '_aviaLayoutBuilderCleanData', true ) );
The content of the post meta is going to be automatically compiled as long as its wrap in the “avia_builder_precompile” filter.
Best regards,
IsmaelJuly 12, 2019 at 7:11 am #1117939Thanks, Ismael, but I’m sorry, I don’t actually “know” php. I took a few stabs at different ways I might integrate that in the code I had, to replace the_content(), but I couldn’t get it to work. Can you tell me how I could use that in this situation?
<?php while ($query->have_posts()) { $query->the_post(); ?> <div> <p><?php the_content(); ?><p> </div> <hr /> <?php } ?>
Thanks so much — sorry for the lack of skills!
July 15, 2019 at 2:19 am #1118642Hi,
Thank you for the update.
Try to replace this part:
?> <div> <?php the_content(); ?></div> <hr /> <?php
.. with:
$content = apply_filters( 'avia_builder_precompile', get_post_meta( get_the_ID(), '_aviaLayoutBuilderCleanData', true ) ); echo $content;
Best regards,
IsmaelJuly 15, 2019 at 7:45 pm #1118909Thanks, so that leaves…
` <?php
while ($query->have_posts())
{
$query->the_post();
$content = apply_filters( ‘avia_builder_precompile’, get_post_meta( get_the_ID(), ‘_aviaLayoutBuilderCleanData’, true ) );
echo $content;
}
?>
…which outputs shortcode on the page (see https://screencast.com/t/0mo9pcDLS ). Anything else I can tweak to get that shortcode to render on the page?Thanks again.
July 17, 2019 at 6:36 pm #1119651Hi,
We extended the core with filter avf_alb_exec_sc_only (config-templatebuilder\avia-template-builder\php\shortcode-template.class.php line 442).
Returning true (boolean) allows to process shortcode also in backend (and on ajax calls) – same as modal preview does. But include checks otherwise you will break stylings in frontend output.
See private content.
This allows to use the normal WP content filter without the workaround mentioned by Ismael.
Best regards,
Günter- This reply was modified 5 years, 5 months ago by Günter.
July 17, 2019 at 8:58 pm #1119688Thanks Günter, but I’m sorry, I’m not clear on how to proceed with this info. Are you saying the issue will be resolved in the next release?
July 18, 2019 at 11:42 am #1119884Hi,
Sorry for not being clear.
You can download the zip file mentioned above in private content an update your theme with FTP.
Adding that code to functions.php of the child theme (or parent theme) allows ALB shortcodes to be executed on ajax calls.
I think this should help to fix the problem. No need to hack the_content.
Best regards,
GünterJuly 18, 2019 at 11:59 am #1119889This reply has been marked as private.July 18, 2019 at 12:28 pm #1119893with the problem I had this error log
[16-Jul-2019 13:56:50 UTC] PHP Warning: Division by zero in /Applications/MAMP/htdocs/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/av-helper-slideshow.php on line 467July 18, 2019 at 1:00 pm #1119901Hi,
This is something different. Please open an own thread. But without having a chance to get access to your backend it is nearly impossible to help.
Check your php version and WP version, disable all plugins, try to reinstall the theme and WP.
Best regards,
GünterJuly 18, 2019 at 3:39 pm #1119946Hi Günter
I’ve already done everything you write to me.
Version WordPress – 5.2.2
Version PHP – 7.3.1 (64bit)
PHP SAPI – apache2handler
Server web – Apache/2.2.34 (Unix)
If it were possible I could send the database and the htdocs folder, if you can try in the test environment.
These are 2 last error logs.
[17-Jul-2019 10:41:04 UTC] PHP Warning: file_get_contents(http://www.mamp.info/feed/mac/MAMP/English/feed/home.json): failed to open stream: HTTP request failed! in /Applications/MAMP/bin/mamp/feed/fetchFeed.php on line 19
[17-Jul-2019 17:24:40 UTC] PHP Warning: Division by zero in /Applications/MAMP/htdocs/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/av-helper-slideshow.php on line 467
Best reagds.
beppemodenaJuly 18, 2019 at 8:52 pm #1120007Thanks, but if the issue will be cleared up in the next release, I’ll just wait for that. But if you could tell me exactly what code I need to add to the child theme functions file, that’d be cool for meantime :)
July 19, 2019 at 1:51 pm #1120190I apologize if I continue in this topic, but I did not understand in which section to open a new one.
I created a video on my you tube channel to describe my problem with the theme.
I’ve already done everything you write to me.
Version WordPress – 5.2.2
Version PHP – 7.3.1 (64bit)
PHP SAPI – apache2handler
Server web – Apache/2.2.34 (Unix)
If it were possible I could send the database and the htdocs folder, if you can try in the test environment.
These are 2 last error logs.
[17-Jul-2019 10:41:04 UTC] PHP Warning: file_get_contents(http://www.mamp.info/feed/mac/MAMP/English/feed/home.json): failed to open stream: HTTP request failed! in /Applications/MAMP/bin/mamp/feed/fetchFeed.php on line 19
[17-Jul-2019 17:24:40 UTC] PHP Warning: Division by zero in /Applications/MAMP/htdocs/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/av-helper-slideshow.php on line 467
Best reagds.
beppemodenaJuly 19, 2019 at 1:52 pm #1120191this is the link to the video https://youtu.be/MP0qAFr1AO8
July 20, 2019 at 2:15 pm #1120443Hi,
This is the code to insert in functions.php:
But check the cangelog – could be that I will add a theme option for that.
Please open it in https://kriesi.at/support/forum/enfold/ at the bottom.
Seems there is something wrong with your MAMP install (/Applications/MAMP/bin/mamp/feed/fetchFeed.php on line 19).
And also make sure to increase WP Memory limit https://docs.woocommerce.com/document/increasing-the-wordpress-memory-limit/ and also add:define( 'WP_MAX_MEMORY_LIMIT', '256M' );
Best regards,
GünterJuly 20, 2019 at 7:01 pm #1120464Thanks again, Günter, but unfortunately, just adding that function/filter from github to the functions.php file in my child theme didn’t seem to work. Do I have to do/change/add something else — maybe in my Search & Filter Pro results.php file, where i have the_content? I have the test running here: http://cb0.a81.mwp.accessdomain.com/services/property-management/properties/ — Again, it loads the first time, but if you try any query it comes up with just blank lines.
- This reply was modified 5 years, 5 months ago by sky19er.
July 21, 2019 at 10:22 am #1120586Hi,
Did you download the beta-3 version from https://kriesi.at/support/topic/trouble-with-the_content-and-advanced-layout-editor/#post-1119651 ?
The filter is not in the 4.5.7 version.
– Download the zip
– unzip on your local machine
– upload with ftp to your serverBest regards,
GünterJuly 21, 2019 at 8:02 pm #1120690Ah, I see, sorry, no — and actually that link you provided to the zip file doesn’t seem to be working — can you send me a new link, please? Or, if the official new release is coming soon, I can just wait for that. Thanks again!
July 22, 2019 at 9:52 am #1120775Hi,
Sorry, see private content for new link.
As Kriesi is on holiday I do not know when he will publish the next release.
Best regards,
GünterJuly 22, 2019 at 8:47 pm #1121003Thanks, FYI I’m getting an error trying to unzip that (see https://screencast.com/t/GcknkqrJy ) — and I don’t see where the password comes into play (I guess maybe in the next step?) — but I’m ok waiting for the next release. Our page is working sufficiently with Ajax turned off in the meantime. Thanks for all your help.
- This reply was modified 5 years, 5 months ago by sky19er.
July 25, 2019 at 2:55 pm #1121918Hi,
Try to install an extractor software like the following.
// https://apps.apple.com/us/app/rar-extractor-free/id646295438?mt=12
It should prompt you to input the password before the extraction.
Best regards,
IsmaelJuly 25, 2019 at 11:50 pm #1122001Thanks, Ismael — that worked. So, now I have the beta 4 in place on my staging site, and the force shortcode execution filter in the functions.php in that child theme, but the issue persists — the content’s still not showing when you change queries on http://cb0.a81.mwp.accessdomain.com/services/property-management/properties/
Any other ideas for me? Thanks again and let me know if you have any other questions.
July 29, 2019 at 12:43 pm #1122731Hi,
Could you give me a WP admin account and FTP access to your staging site please?
I would need to add some debugging code and make some changes to see what is going on behind the sceen.
I’m this week on holiday – so it will be next week I can have a look into it.
Best regards,
GünterAugust 10, 2019 at 12:58 am #1126356Sure — I actually already provided them on July 5th, but here they are again for your convenience ;) . Thanks and let me know if you have other questions.
August 19, 2019 at 1:32 am #1128760Hi,
Sorry for the delay.
Where can we see the file modifications? Can we access it? We would like to check how the plugin renders the list.
Best regards,
IsmaelAugust 21, 2019 at 1:21 am #1129380I’ll include sftp credentials in the private field. Let me know if there’s anything else I can help with.
August 22, 2019 at 2:13 am #1129813Hi,
Thank you for the update.
We set the “exec_sc_only” filter to always return true, which seems to help. However, I’m not sure if this is going to affect anything else. Just to make sure try to add a conditional function to the filter so that it is only executed on the page with the search filter.
// https://developer.wordpress.org/reference/functions/is_page/
Best regards,
IsmaelAugust 22, 2019 at 2:47 am #1129817Thanks — that does seem to work — and I don’t see anything else wrong with the site on the front end because of it, but it did seem to trigger one of those new, WordPress 5.2 notices, pointing to a problem with https://abodecommunities.org/wp-admin/admin-ajax.php…
Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email. In this case, WordPress caught an error with your theme, Enfold. First, visit your website (https://abodecommunities.org/) and check for any visible issues. Next, visit the page where the error was caught (https://abodecommunities.org/wp-admin/admin-ajax.php) and check for any visible issues.
I’m not sure how to implement the conditional function you referred to, but it doesn’t seem like that would solve this issue, right?
Now I’m working/testing on the live site: https://abodecommunities.org/services/property-management/properties/
Thanks and lmk if you have any questions.
August 23, 2019 at 8:49 am #1130245Hi,
I’m not sure how to implement the conditional function you referred to, but it doesn’t seem like that would solve this issue, right?
Actually, it would. In the functions.php file, inside the “exec_sc_only” filter, look for this line.
return true;
Wrap it inside conditional functions like so.
if(!is_admin() && is_page(24)) { return true; }
That should prevent the filter from executing the shortcodes on the admin page. Replace 24 with the actual ID of the page where you have the search filter. You can also use an array of IDs as value in case you want to enable it on more than one page.
if(!is_admin() && is_page(array(24, 45, 75))) { return true; }
Best regards,
Ismael -
AuthorPosts
- The topic ‘trouble with the_content(); and Advanced Layout Editor’ is closed to new replies.