Viewing 30 posts - 1 through 30 (of 32 total)
  • Author
    Posts
  • #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.

    #1116568

    Hey 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,
    Ismael

    #1117939

    Thanks, 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!

    #1118642

    Hi,

    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,
    Ismael

    #1118909

    Thanks, 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.

    #1119651

    Hi,

    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.
    #1119688

    Thanks 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?

    #1119884

    Hi,

    Sorry for not being clear.

    You can download the zip file mentioned above in private content an update your theme with FTP.

    Check https://github.com/KriesiMedia/enfold-library/blob/master/actions%20and%20filters/ALB%20Elements/General%20filters/avf_alb_exec_sc_only.php.

    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ünter

    #1119889
    This reply has been marked as private.
    #1119893

    with 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 467

    #1119901

    Hi,


    @beppemodena

    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ünter

    #1119946

    Hi 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.
    beppemodena

    #1120007

    Thanks, 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 :)

    #1120190

    I 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.
    beppemodena

    #1120191

    this is the link to the video https://youtu.be/MP0qAFr1AO8

    #1120443

    Hi,


    @sky19er

    This is the code to insert in functions.php:

    https://github.com/KriesiMedia/enfold-library/blob/master/actions%20and%20filters/ALB%20Elements/General%20filters/avf_alb_exec_sc_only.php

    But check the cangelog – could be that I will add a theme option for that.


    @beppemodena

    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ünter

    #1120464

    Thanks 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.
    #1120586

    Hi,


    @sky19er

    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 server

    Best regards,
    Günter

    #1120690

    Ah, 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!

    #1120775

    Hi,


    @sky19er

    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ünter

    #1121003

    Thanks, 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.
    #1121918

    Hi,

    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,
    Ismael

    #1122001

    Thanks, 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.

    #1122731

    Hi,

    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ünter

    #1126356

    Sure — 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.

    #1128760

    Hi,

    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,
    Ismael

    #1129380

    I’ll include sftp credentials in the private field. Let me know if there’s anything else I can help with.

    #1129813

    Hi,

    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,
    Ismael

    #1129817

    Thanks — 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&#8230;

    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.

    #1130245

    Hi,

    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

Viewing 30 posts - 1 through 30 (of 32 total)
  • The topic ‘trouble with the_content(); and Advanced Layout Editor’ is closed to new replies.