Internal Shortcode | [Post_Title]
EkoJr edited this page Jan 3, 2017
·
2 revisions
Adds the Post Title.
[post_title]
(string) WP_Post->Post_Title.
[post_title]
Returns
Title Example
File: advanced-post-list/includes/class/apl_shortcodes.php
/**
* Post Title Shortcode.
*
* Desc: Adds the post/page title.
*
* 1. Add to return Post Post_Title.
* 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->post_title.
*/
public function post_title($atts)
{
//INIT
$atts_value = shortcode_atts( array() , $atts, 'post_title');
$return_str = '';
//STEP 1
$return_str .= htmlspecialchars($this->_post->post_title);
//STEP 2
return $return_str;
}