I am using a L&L ACF Relationship Loop shortcoded inside of a Beaver Builder post module.
The strangest thing is that it is only showing on the EVEN posts. Any idea what could be going on here? If I rearrange the posts, the relationship loop output stays on the 2nd, 4th, and 6th posts so it’s not tied to specific posts, but specific locations.
Here is the page. You can see the post layout with the L&L shortcode in it. And you can see the output at the bottom of those specific posts locations:
Hi Zack, this is really odd!
Could you try modifying your template to remove the “/” from the “{Field url /}” passed to your anchor tag? Could send me a link to the page and I’ll try to work out what’s going on based on your outputted markup. Is there any chance there’s a rogue CSS rule at work?
I think the ultimate problem is that the relationship loop doesn’t understand it’s in a Beaver Builder loop.
What I do in that case is a bit kludgy, but I set the entire BB post module layout to
[template id=12345 pid=[wpbb post:id]]
Inside that template, create a loop for each single item, which lets you create the relationship loop.
<Loop type="my-cpt" id="{Get local=pid}">
(enter the stuff you already have)
<Loop acf_relationship=resource_solution>
That works on an Archive Template page. If you’re on a Singular Template page you can always just add a separate posts module for your ACF relationship info.
Yeah, I could try that and see. I’ll keep that as a backup to try But to clarify it does understand that it’s in a BB loop as it’s working 1/2 the time (even posts) haha
Maybe. Or it could be grabbing half the posts from one side of your relationship and half from the other side which doesn’t offer any data … or something like that.
Thanks for the access! I have no idea why every other post was working. The relationship loop was getting the context of the Customers page, but I’m not sure why it was displaying anything at all. Adding a post_in attribute with the value [wpbb post:id] and passing it to the loop in the template fixed the issue. I also added an optional post_type attribute in case you use this template for another post type.
Hi @zack and @RichardC, thanks for your efforts to document this issue. While @julia’s workaround of passing the post id as a variable to the template may work, it’s kinda circumventing the normal way that L&L is designed to work (which is to get the current context of whatever current post/page a template is placed on without needing to pass these as variables to the template). It took quite some effort to find and resolve this but I’m happy to report that in the latest 3.0.0 release of Loops & Logic, we’ve managed to resolve this. From now on, simply adding the [template id=123] shortcode to the Beaver Builder Custom Post Layout editor will correctly get the right post information every time without needing to pass post ID data to the template.
I’ve also been told that the efforts that were put in to resolve this have improved all page builder previews as well as the template shortcode overall so thanks for your help in identifying this issue. It seems we’ve been able to strengthen the foundation of L&L thanks to your sleuthing!
Hey @zack, I just followed up on your email and I think you simply made an error in the way you removed Julia’s workaround. As far as I could tell from the info in your email, L&L 3.0.0 is working as expected.