wordpress_add

Friday 6 September 2013

FOR GETTING POST IN ANY WEB PAGE

This is the method to get the selective post (  $post_id = 26; 26 is the id it may be change )

Method 1 <?php
$post_id = 26;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo $title;
echo $queried_post->post_content;
?>



Method 2

<?php // retrieve one post with an ID of 1
query_posts('p=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<h4><?php the_title(); ?></h4>
<?php the_content(); ?>
<?php endwhile;?>

Subscribe us for Important Knowledge of word press.Your's suggestions are most welcomed..

No comments:

Post a Comment