• Resolved jarth3000

    (@jarth3000)


    Hello!

    I can get the plugin to work with your basic repeater template, but when I make changes to the template it no longer works.

    Here is the shortcode I’m using:

    [ajax_load_more post_type="results" posts_per_page="6" scroll="false" pause="true"]

    And here is the repeater template:

    <div class="results-item">
    	<!-- article -->
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    		<!-- post thumbnail -->
    			<img src="<?php echo get('results_image'); ?>" />
    		<!-- /post thumbnail -->
    
    	</article>
    	<!-- /article -->
    </div>

    I suspect it has something to do with the custom field that I’m attempting to pull, but from reviewing your support page here the plugin should support custom fields. So I’m not sure what the issue is.

    Any guidance would be much appreciated!

    https://wordpress.org/plugins/ajax-load-more/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Yea I also suspect it doesn’t know what get('results_image') is.

    Can you confirm there are no errors with that code?

    Thread Starter jarth3000

    (@jarth3000)

    No errors.

    I’m using Magic Fields 2 to create the custom fields, of which that results_image is one.

    Thread Starter jarth3000

    (@jarth3000)

    But to that end, if the code is correct, should the plugin just be running said code? Or is it rendering differently?

    I haven’t really dug into your code at all to see how it’s doing everything.

    Plugin Author Darren Cooney

    (@dcooney)

    it should have access to that function. For example, Advanced Custom Fields work within the repeater templates.
    The repeaters are just include files.

    If you remove that line does it render?

    Thread Starter jarth3000

    (@jarth3000)

    I can confirm that’s what’s the issue.

    I just inspected the html that is spit out on the page load and it begins to load, but when it hits where that image would be it stops.

    Thread Starter jarth3000

    (@jarth3000)

    It renders fine up until that line of code.

    Plugin Author Darren Cooney

    (@dcooney)

    Ill install Magic Fields 2 and test this out later today.

    Thread Starter jarth3000

    (@jarth3000)

    Thanks.

    Plugin Author Darren Cooney

    (@dcooney)

    Ok so you need to include a core file (mf_front_end.php) from Magic Fields 2 to have this work with Ajax calls.

    Here is my working repeater:

    <li>
    <?php
    $root = $_SERVER['DOCUMENT_ROOT'];
    require_once($root . '/wp-content/plugins/magic-fields-2/mf_front_end.php');
    ?>
    <h2><?php echo get('test_field') ;?></h2>
    <h3><a href="#" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <p class="entry-meta">
        <?php the_time("F d, Y"); ?> - page(<?php echo $alm_page; ?>) - item(<?php echo $alm_item; ?>)</p>
    </p>
    <?php the_excerpt(); ?>
    </li>

    This is the thread that helped me out – https://wordpress.org/support/topic/using-magic-fields-2-template-functions-with-ajax-calls?replies=3

    Reviews are always appreciated if I have helped you solve the issue πŸ™‚

    Best of luck.

    Thread Starter jarth3000

    (@jarth3000)

    You sir, are fantastic.

    Thank you very much.

    Review inbound.

    Plugin Author Darren Cooney

    (@dcooney)

    Excellent πŸ™‚
    Cheers!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Not Working’ is closed to new replies.