Easy, I’ve done something similar to show an Amazon ad right after the first post… here’s how:
1) Open your index.php page.
2) Find the line that looks like this:
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
This starts what is known as the WP-Loop.
3) Just before that line put this:
<?php $FirstPost = TRUE; ?>
4) Next find this line:
<?php the_content(); ?>
5) Replace it with this:
<?php if ($FirstPost == TRUE ) {
the_content();
$FirstPost = FALSE;
}else{
the_excerpt();
}?>
Save it, and run it.
That should do it for you.
TG
Thread Starter
guruxl
(@guruxl)
It is not working for me, in anycase, I am looking for a more pragmatic solution. Can anyone come up with something?
Thread Starter
guruxl
(@guruxl)
Well I didn’t want to have to modify code but, since it seems inevitable, I guess I will have to get my hands dirty.
Guru,
Find this:
<?php if ($FirstPost == TRUE ) {
the_content();
$FirstPost = FALSE;
}else{
the_excerpt();
}?>
And replace it with:
<?php if ($FirstPost == TRUE ) {
the_content();
$FirstPost = FALSE;
}else{
the_excerpt();
echo "
the_ID();
echo "'>";
the_author();
echo ": ";
the_title();
echo "";
}?>
That worked for me.
Okay, I hacked the wp-includes/templates-function-post.php to $excerpt_length = 40;
(I wish there was a better way). That took care of my first wish. Now, how do I change the_title();
to reflect an image that links to the post?
techgnome’s solution works perfectly. thank you