-
Notifications
You must be signed in to change notification settings - Fork 7
Internal Shortcode | [Guid]
EkoJr edited this page Mar 16, 2017
·
3 revisions
Adds the post/page unique url (aka Guid). WP's Default URL (.com/?p=396).
It is usually preferred to use [post_permalink] structure.
[post_guid]
(string) WP_Post Guid.
[guid]
Returns
http://example.com/?p=123
File: advanced-post-list/includes/class/apl_shortcodes.php
/**
* Post Guid (WP Default URL) Shortcode.
*
* Desc: Adds the post/page Guid. WP's Default URL (.com/?p=396).
*
* 1. Add to return Post's Guid.
* 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 Post Guid.
*/
public function guid($atts)
{
//INIT
$atts_value = shortcode_atts( array() , $atts, 'post_guid');
$return_str = '';
//STEP 1
$return_str .= $this->_post->guid;
//STEP 2
return $return_str;
}
[post_permalink] - WP Default URL.