Skip to content

Internal Shortcode | [Post_Content]

EkoJr edited this page Jan 13, 2017 · 1 revision

Description

Adds the Post's Content. Unlike [post_excerpts], content will be displayed in full.

Usage

[post_content]

Return

(string) post Content (unformatted).

Examples/Sample

Example 1

[post_content]

Returns

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Source

File: advanced-post-list/includes/class/apl_shortcodes.php

/**
 * Post Content Shortcode. 
 * 
 * Desc: Adds the Post_Content. 
 * 
 * 1. Add to return the Post's Post_Content. 
 * 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 None.
 * @return string Post->Post_Content.
 */
public function post_content($atts)
{
    //INIT
    $atts_value = shortcode_atts( array() , $atts, 'post_content');
    $return_str = '';
    
    //STEP 1
    $return_str .= $this->_post->post_content;
    
    //STEP 2
    return $return_str;
}

Additional Resources

[post_excerpts] - Adds the Post's Excerpt (short content).

Clone this wiki locally