Skip Navigation

[Resolved] shortcode wrong output

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Shane 6 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#611146
Story Layout Link Shortcode.png
Story Layout - Prev Link.png
Story Layout - Next Link.png

I have a page template going in Beaver Builder. Everything is great expect one problem. When I use the shortcode for next post, it outputs perfectly. When I use the shortcode for previous post, it outputs with the title. I confirmed this error by change the next to previous, and it errored, then back to next, and it was correct... see the attached screenshots.

I think that this has to do with what the shortcode is outputting.

Let me know!

#611176

I think that this is a problem with the way the link is outputting since it won't give me the RAW link option, it's jamming up the Beaver Builder output in the HTML.

I'll keep troubleshooting.

If you have advice on this, please share. Otherwise, you may close the ticket.

Thanks.

#611188

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robina,

Thank you for contacting our support forum.

Could you perform a simple test for me ? Does this issue occur when you add both these shortcodes to a simple post using the default wordpress editor ?

I would like to see if the issue is being caused by the builder.

Please let me know.
Thanks,
Shane

#611199

When I use the shortcode on the standard post it generates the full link.

The problem is that in the builder I ONLY need the link URL not the entire element.

It might be a good idea to have this generate a URL only. But in the meantime, maybe we can generate this with PHP and a shortcode.

Let me know.

#611215

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robina,

Try using this custom shortcode here.

// Add Shortcode
function previous_post_url() {

	$prev_post = get_previous_post();
	return get_post_permalink($prev_post);

}
add_shortcode( 'previous_post_url', 'previous_post_url' );

Add it to your functions.php file and you can use it by adding this [previous_post_url]

Please let me know if this works.
Thanks,
Shane