/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Add following code in your functions.php file inside your theme folder. <?php { function getPageContent($pageId,$max_char) { { return; } global $wpdb; $nsquery = 'SELECT DISTINCT * FROM ' . $wpdb->posts . ' WHERE ' . $wpdb->posts . '.ID=' . $pageId; $post_data = $wpdb->get_results($nsquery); { foreach($post_data as $post) { } } } } ?> And to display text you have to call the function like <?php echo getPageContent(11,150); //First parameter is PAGE ID and second is number of words displayed. ?>
Comments
