Posts module [wpbb post:excerpt] breaks loop

We’ve discovered a strange bug when using the bb posts module on a single post page.
We use it to display related posts.

When we use the following custom layout:

<div class="fl-col-content">
    <div class="fl-post-image" style="background: url('[wpbb post:featured_image size='large' display='url']')"></div>
        <div class="fl-post-text">
            <h2 class="fl-post-title small-header">[wpbb post:link text="title"]</h2>
            <div class="fl-post-excerpt">
                **[wpbb post:excerpt length="25" more="..."]**
            </div>
        </div>
        <div class="fl-button-wrap">
            <a class="fl-button" href="**[wpbb post:url]**">
                <span class="fl-button-text">Read more</span>
            </a>
        </div>
</div>

after using [wpbb post:excerpt] the url [wpbb post:url] returns the url of the current post, not the post in the loop for related posts.

We’ve tested it, and all values after using post:excerpt, like [wpbb post:link text=“title”] and [wpbb post:url], return the data of the current post, not the data of the looped posts.
So in the example code above, image, title, excerpt text are all correctly displayed, except for the link on the read more button. Which points to the current postpage.

With the default bb posts layout the read more link fails as well. So it’s not specifically caused by the custom layout.

It seems this problem occurres since the latest beaver builder update. Can you fix this issue?

That shortcode will not return the related posts on single post page. I got one tut on BB Knowledge Base site. You can follow this guide line

https://kb.wpbeaverbuilder.com/article/610-use-the-posts-module-to-create-related-posts

We’ve already used the posts module and excluded the current post. The code you see above is when you select “Custom layout” in the Layout tab of the posts module. Please reread the issue…

Hi Bob,

Field connection shortcodes will return the current posts info i.e. [wpbb post:url] would return the current posts link not the related posts link.

The best approach would be to use the ACF relationship field, see below.

https://kb.wpbeaverbuilder.com/article/629-list-related-posts-using-acf-relationship-field-themer

Thanks for the responses. I’ll check it out.

Still pretty strange that all other shortcodes like [wpbb post:url] work to display other posts in the posts module prior to the [wpbb post:excerpt] shortcode. Can you explain?

The shortcodes will work, but if you use them on a single post it will pull in the current posts data. So on a single post the post URL is the current post you’re viewing so that will be the link for the post.

The same goes for post title, featured image and so forth. This is why if you want to create a section on your single post for related posts you will want to use the Post module without using the custom layout editor/field connections or the method I linked above. :slight_smile:

But that is the weird part. The title and feature image are displaying the related posts content. Even the URL works. But once I use the excerpt shortcode, all shortcodes that follow for that related post show the current posts data. The same problem occurs when I don’t use the custom layout, but a default bb posts module layout. So that doesn’t solve it.

Because it’s only the excerpt that causes the problem, I’m curious if it’s a bug that can be fixed. Or is there a shortcode that displays only the summary and evades the excerpt issue?

(I solved my particular issue by placing the read more link url shortcode above the excerpt shortcode and use css to place the read more link under the excerpt while displaying. But i’d rather do it in a logical stuctured fashion.)

Hi Bob,

That shouldn’t be working in that way. Can you send us a support ticket so our team can take a closer look.