WordPress Get Page Content By Page Id

posts .
            ' WHERE ' . $wpdb->posts . '.ID=' . $pageId;
            $post_data = $wpdb->get_results($nsquery);
                foreach($post_data as $post)
                    $text_out=str_replace(']]>', ']]>', $text_out);
                    $text_out = strip_tags($text_out);
                    return substr($text_out,0,$max_char);


Call the above function in your page:

//First parameter is PAGE ID and second is number of words displayed. ?>

About the author

Janaki(http://mjanaki.com) - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Query X Number of Recent Posts
WordPress Tricks

Leave a reply


Eye Test: * Time limit is exhausted. Please reload CAPTCHA.