Problem: I would like to design custom next and previous links, but the wpv-post-next-link and wpv-post-previous-link shortcodes produce full link tags. I need to access only the URLs.
Solution: Please add this code to your theme's functions.php file:
function ts_get_adjacent_post_url_func($atts) { global $post; $previous = ($atts['previous'] == "1"); $adjacent = get_adjacent_post( false, '', $previous); return get_the_permalink($adjacent); } add_shortcode("ts_get_adjacent_post_url", "ts_get_adjacent_post_url_func");
Then you can access the next and previous post URLs in a Content Template like this:
Next URL: [ts_get_adjacent_post_url previous="0"]<br /> Previous URL: [ts_get_adjacent_post_url previous="1"]<br />
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 6 replies, has 2 voices.
Last updated by Christian Cox 6 years, 1 month ago.
Assisted by: Christian Cox.