ok i got this code but how do i specify a specific post using its id ?
<?php
//The Query To Get Posts
$my_query = new WP_Query('showposts=3');
//Run the Query and Loop Through Results
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
?>
<?php
$string = get_the_content('');
$newString = substr($string, 0, 20);
echo $newString;
?>
<?php endwhile; ?>
Well i was able to figure it out…ehe!! after 3 hours 🙂 for anyone who needs to know here is the code i used…
<?php
$post_id = 5;
$queried_post = get_post($post_id);
?>
<?php
$string = get_the_content('');
$newString = substr($string, 0, 120);
echo $newString;
?>
well…need some help…its pulling the content but on one page when i have this
<?php
$post_id = 5;
$queried_post = get_post($post_id);
?>
<?php
$string = get_the_content('');
$newString = substr($string, 0, 100);
echo $newString;
?>
<?php
$post_id = 4;
$queried_post = get_post($post_id);
?>
<?php
$string = get_the_content('');
$newString = substr($string, 0, 100);
echo $newString;
?>
and instead of pulling post with id 4 its pulling the same post so if we are on post with id 4 it pulls the same post though we have specified that it should pull post with id 4 and 5
Am so close…i just need to know what i need to adjust in this code to enable the character limit to work..
<?php
$post_id = 4;
$queried_post = get_post($post_id);
echo $queried_post->post_excerpt;
?>
<?php
$string = get_the_content('');
$newString = substr($string, 0, 100);
echo $newString;
?>