Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #486079

    Hey guys,

    im trying to implement the page break element of the advanced page builder with an infinite scroll functionallity.
    So far the ajax call is working fine, im getting the desired contentblocks to load, but only uncomplied, like so:
    [av_section min_height=’100′ min_height_px=’900px’ …

    Even though im applying the necessary filter..
    Inside of the loop (e.g. in template-buildler.php the filter works just fine, when i comment out line 41 in there:

    $content = apply_filters(‘the_content’, $content);

    i see the shortcodes. when i put it back in the content is displayed properly

    However when loading additional content via ajax it only gives me the shortcodes and does not convert it into plain html
    Here is my ajax function inside of my child themes functions.php:

    function wp_infinitepaginate() {
    global $page;
    $content = apply_filters(‘avia_builder_precompile’, get_post_meta(431, ‘_aviaLayoutBuilderCleanData’, true));
    $content = apply_filters( ‘the_content’, $content );
    $content = apply_filters(‘avf_template_builder_content’, $content);

    echo $content;
    exit;
    }

    • This topic was modified 9 years, 4 months ago by meergut.
    #486289

    Hey meergut!

    Thank you for using Enfold.

    I’m not sure how your custom code works but maybe you can add the do_shortcode function to process the shortcodes. https://developer.wordpress.org/reference/functions/do_shortcode/

    Best regards,
    Ismael

    #486358

    Hey Ismael,

    thanks for your reply, ive tried the do_shortcode, but it doenst do any good :-/
    it still just gets printed as shortcodes [av_section (and so on)

    to implement the infinite scroll i followed a tutorial on tuts+:
    http://code.tutsplus.com/tutorials/how-to-create-infinite-scroll-pagination–wp-24873

    When the user scrolls to the bottom of the screen the function wp_infinitepaginate() is executed
    and the echo is appended to the main container via jquery.

    Why is the convertion to html not working here?

    revised function:

    function wp_infinitepaginate() {

    $myID = 431;
    $page = $_POST[‘page_no’];
    $post = get_post($myID);

    $content = apply_filters(‘avia_builder_precompile’, get_post_meta(431, ‘_aviaLayoutBuilderCleanData’, true));
    $content = apply_filters( ‘the_content’, $content );
    $content = apply_filters(‘avf_template_builder_content’, $content);
    echo do_shortcode($content);

    exit;
    }

    • This reply was modified 9 years, 4 months ago by meergut.
    #486407

    Applying the $content = apply_filters( ‘the_content’, $content ); filter wraps the shorttags inside p tags,
    so the filter is somehow recognized, but the enfold themes’ custom filters are not executed, am i seeing this right?
    Do you know why this is? Or maybe is there another way to convert the shorttags?

    <p>[av_section min_height=’100′ min_height_px=’900px’ padding=’default’ shadow=’no-shadow’ bottom_border=’no-border-styling’ id=” color=’main_color’ custom_bg=” src=’http://neues.meerdesguten.com/wp-content/uploads/2015/02/startseite_gda_bg_150716_fz.jpg’ attachment=’2233′ attachment_size=’full’ attach=’parallax’ position=’center center’ repeat=’stretch’ video=” video_ratio=’16:9′ overlay_opacity=’0.5′ overlay_color=” overlay_pattern=” overlay_custom_pattern=” custom_class=’mdg_post’]<br>
    [av_icon_box position=’left’ boxed=” icon=’ue84a’ font=’entypo-fontello’ title=’NOMINEE’ link=” linktarget=” linkelement=” font_color=’custom’ custom_title=’#647c89′ custom_content=’#ffffff’ color=” custom_bg=” custom_font=” custom_border=” custom_class=’mdg_category’][/av_icon_box]</p>

    • This reply was modified 9 years, 4 months ago by meergut.
    #486959

    Hi!

    What if you add a strip_tag function to remove the p tags? http://php.net/manual/en/function.strip-tags.php

    Regards,
    Ismael

    #487136

    Hi Ismael!

    i dont see, how this is going to help, I tried it anyways:

    $content = apply_filters(‘avia_builder_precompile’, get_post_meta(431, ‘_aviaLayoutBuilderCleanData’, true));
    $content = apply_filters( ‘the_content’, $content );
    $content = apply_filters(‘avf_template_builder_content’, $content);
    echo do_shortcode(strip_tags($content));

    The p tags are not generated until the $content = apply_filters( ‘the_content’, $content ); function.
    That is the filter that should convert the avia shortcodes as well, but it just puts them out as is..

    I based my code on the one in template-buildler.php, where it works as expected strangely enough..
    Does it maybe have to do with the loop? Does the filter not work outside of the regular wordpress loop?
    Im using the same lines inside functions.php, never the less get a different outcome..
    im stuck here.

    #487154

    just tried something for reference:

    when i create a new page template page-2270.php and put the following code in it:

    <?php
    $content = apply_filters(‘avia_builder_precompile’, get_post_meta(431, ‘_aviaLayoutBuilderCleanData’, true));
    $content = apply_filters( ‘the_content’, $content );
    $content = apply_filters(‘avf_template_builder_content’, $content);
    echo $content;
    ?>

    the shortcodes are rendered..

    However when i put it in an ajax call the they’re not.

    function wp_infinitepaginate() {
    global $avia_config;

    $content = apply_filters(‘avia_builder_precompile’, get_post_meta(431, ‘_aviaLayoutBuilderCleanData’, true));
    $content = apply_filters( ‘the_content’, $content );
    $content = apply_filters(‘avf_template_builder_content’, $content);
    echo do_shortcode($content);

    exit;
    }

    add_action(‘wp_ajax_infinite_scroll’, ‘wp_infinitepaginate’); // for logged in user
    add_action(‘wp_ajax_nopriv_infinite_scroll’, ‘wp_infinitepaginate’); // if user not logged in

    is there something else i need to include in my function to make it work?

    #487312

    Maybe another approach is more promising.

    What im trying to accomplish is a page with a large amount of subsequently loaded av_sections,
    just like on facebook, where you can scroll down to get more news.

    Is this maybe a feature to be implemented in future releases, or do you have an idea how to implement this?
    Ideally, each av_section would be an individual post (in wordpress terminology).
    However, at the moment i’m basing it off a singular page…

    #488536

    Hi!

    I’m sorry but what you’re trying to do here is outside the scope of support and is considered as a custom work. You can hire a freelance developer or contact codeable: http://kriesi.at/contact/customization

    Cheers!
    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.