Posts

Wordpress get Page content By Page ID

<?php if(!function_exists('getPageContent')) { function getPageContent($pageId,$max_char) { if(!is_numeric($pageId)) { return; } global $wpdb; $nsquery = 'SELECT DISTINCT * FROM ' . $wpdb->posts . ' WHERE ' . $wpdb->posts . '.ID=' . $pageId; $post_data = $wpdb->get_results($nsquery); if(!empty($post_data)) { foreach($post_data as $post) { $text_out=nl2br($post->post_content); $text_out=str_replace(']]>', ']]>', $text_out); $text_out = strip_tags($text_out); return substr($text_out,0,$max_char); } } } } ?> How to Call function getPageContent? <?php echo getPageContent(11,150); //First parameter is PAGE ID and second is number of words displayed. ?>

Limit the Number of Characters in a Textarea or Text Field

removing link outline around

Some browser when you click on link text or link image you always see outline box around text or image link. a, object { outline: none; }

safari disable resize textarea

You can use the CSS3 'resize' property to "specify whether or not an element is resizable by the user": textarea { resize:none; } or you can use textarea { max-width: 175px; /* RESTRICT SAFARI RESIZE */ max-height: 250px; /* RESTRICT SAFARI RESIZE */ }

Wordpress get page title by page id.

Get page content by page id Wordpress

I have written a function and now I can fetch the content of any page or one more pages just by the page id. <?php if(!function_exists('getPageContent')) { function getPageContent($pageId) { if(!is_numeric($pageId)) { return; } global $wpdb; $sql_query = 'SELECT DISTINCT * FROM ' . $wpdb->posts . ' WHERE ' . $wpdb->posts . '.ID=' . $pageId; $posts = $wpdb->get_results($sql_query); if(!empty($posts)) { foreach($posts as $post) { return nl2br($post->post_content); } } } } ?> For exampe, <?php echo getPageContent(6); ?>

Get page content by page id Wordpress