• Resolved heatherc747

    (@heatherc747)


    My shortcode:
    [ajax_load_more id="homepage-series" container_type="div" posts_per_page="4" scroll="false" button_label="Show More" repeater="default" orderby=”post__in” acf="true" acf_field_type="relationship" acf_field_name="series"]

    My template:

    <?php
                                $featured_img_url = get_the_post_thumbnail_url(get_the_ID(), 'card-rollover');
                            ?>
                            <div class="col">
                                <a href="<?php the_permalink(); ?>" class="rollover-card" style="background-image:url('<?php echo $featured_img_url; ?>');">
                                    <div class="inner">
                                        <div>
                                            <span class="top-lines"></span>
                                            <span class="bottom-lines"></span>
                                            <span class="label">
                                                Book Series
                                            </span>
                                            <h3 class="h5">
                                                <?php the_title(); ?>
                                            </h3>
                                            <div class="content">
                                                <div class="content-inner">
                                                    <?php the_field('rollover_summary'); ?>
                                                </div>
                                            </div>
                                            <span class="btn-text on-dark">
                                                Explore
                                            </span>
                                        </div>
                                    </div>
                                </a>
                            </div>

    Field is a Relationship that’s returning Post ID.

    The load more button appears for second, then is gone, and nothing else is returned. Not sure what I’m missing?

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

    (@dcooney)

    @heatherc747
    Is the ACF field you are pulling data from on the same page as your ALM shortcode? I notice you are not passing in the post ID.
    Any chance you have a public link I can check out? I’m not sure what the issue would be as the code looks ok.

    Thread Starter heatherc747

    (@heatherc747)

    Is the ACF field you are pulling data from on the same page as your ALM shortcode?
    – Yes it is

    I notice you are not passing in the post ID.
    – I have it set up in the custom fields to return as the post ID.

    Any chance you have a public link I can check out? I’m not sure what the issue would be as the code looks ok.
    – Here is the URL, https://dev-templeton-press.pantheonsite.io/ , the section on the page is “Our Book Series”

    Plugin Author Darren Cooney

    (@dcooney)

    Try setting the acf_post_id parameter. I can see the query is being set to 0 for some reason.

    [ajax_load_more acf="true" acf_post_id="<?php echo get_the_ID(); ?>" ... ]

    Thread Starter heatherc747

    (@heatherc747)

    Updated the shortcode, still nothing.

    <?php echo do_shortcode('[ajax_load_more acf="true" acf_post_id="<?php echo get_the_ID(); ?>" id="homepage-series" container_type="div" posts_per_page="4" scroll="false" button_label="Show More" repeater="default" orderby="post__in" acf_field_type="relationship" acf_field_name="series"]'); ?>

    Thread Starter heatherc747

    (@heatherc747)

    FWIW I have ALM working just fine here, https://dev-templeton-press.pantheonsite.io/catalogs/ . However that is not using an ACF field, that is just pulling the posts.

    Plugin Author Darren Cooney

    (@dcooney)

    Thanks. Looks like the problem has something to do with this being a frontpage and it not having a Post ID.

    How are you setting the frontpage? If you could assign the template to a page I believe this will work. Right now, ALM thinks the Post ID is 0.

    Also, though this isn’t the problem you have an error in your shortcode syntax.
    <?php echo do_shortcode('[ajax_load_more acf="true" acf_post_id="'. get_the_ID() .'" id="homepage-series" container_type="div" posts_per_page="4" scroll="false" button_label="Show More" repeater="default" orderby="post__in" acf_field_type="relationship" acf_field_name="series"]'); ?>

    Thread Starter heatherc747

    (@heatherc747)

    Hmm. Well the post ID is 370 and it returns when I echo it. I’m setting the front page in Settings > Reading, it’s a static page.

    Thanks for your help thus far!

    Plugin Author Darren Cooney

    (@dcooney)

    Ok, well make sure you update your shortcode.

    And confirm that you have wp_reset_query() or wp_reset_postdata() any previous queries on the page. Could be an issue there.

    If that doesn’t work. please feel free to open a support ticket and I can have a look.
    https://connekthq.com/support/?product=Ajax Load More

    Plugin Author Darren Cooney

    (@dcooney)

    As discussed over email, you are missing the post_type declaration in the shortcode.

    post_type="books"

    Thread Starter heatherc747

    (@heatherc747)

    Thank you!!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Relationship not returning anything’ is closed to new replies.