-
Notifications
You must be signed in to change notification settings - Fork 7
Internal Shortcode | [Post_Permalink]
EkoJr edited this page Mar 16, 2017
·
4 revisions
Post Permalink (URL) Shortcode associated with WP's Permalink configuration (Settings->Permalinks) for WP_Post Objects.
[post_permalink]
(string) Permalink/URL from WP_Post ID.
[post_permalink]
Returns
http://example.com/.../post_slug
File: advanced-post-list/includes/class/apl_shortcodes.php
/**
* Post Permalink (URL) Shortcode.
*
* Desc: Adds the post/page permalink/URL.
*
* 1. Get & Add to return Post's Permalink.
* 2. Return string.
*
* @since 0.1.0
* @version 0.4.0 - Changed to Class function, and uses WP's built-in
* functions for setting default attributes & do_shortcode().
*
* @param array $atts
* @return string Permalink associated with Post ID.
*/
public function post_permalink($atts)
{
$atts_value = shortcode_atts( array() , $atts, 'post_permalink');
$return_str = '';
$return_str .= get_permalink($this->_post->ID);
return $return_str;
}
[guid] - WP Default URL.