...

View Full Version : Wordpress Showing posts on homepage



a4udi
03-16-2012, 03:48 PM
I've got a piece of code that was working fine on one site but now it's being all weird on another website. It takes the first 3 posts from my blog and posts a short summary of them, then a "read more" link.

For some reason it is making the formatting of the first post different and not including the "read more" links. the text is there, but not the links.

Here's the link and the code

http://www.latitudesadventure.com/index-test.php (at the bottom of the page)


<p align="left">
<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('./travel/wp-load.php');
query_posts('showposts=3');
?>


<?php
/* site_last_updated
*
* This will check the modified_date of all published posts and give you the most recent date.
*
*/
function site_last_updated($d = '') {
$recent = new WP_Query("showposts=3&orderby=modified&post_status=publish");
if ( $recent->have_posts() ) {
while ( $recent->have_posts() ) {
$recent->the_post();
$last_update = get_the_modified_date($d);
}
echo $last_update;
}
else
echo 'No posts.';
}
?>
<?php query_posts('posts_per_page=3');?>
<?php while (have_posts()): the_post(); ?>
<?php endwhile; ?>
<span class="title">The Latest News from Costa Rica</span><br/>
<span class="subtours">Last Updated: <?php site_last_updated('') ?></span><br/><br/>
<span class="bodytext"><?php while (have_posts()): the_post(); ?></span>
<span class="hoteltitle"><?php the_title(); ?></span>
<span class="bodytext"><?php the_excerpt(); ?></span>
<?php endwhile; ?>

</p>

mlseim
03-16-2012, 06:15 PM
Try this instead ....





<span class="title">The Latest News from Costa Rica</span><br/>
<?php query_posts('posts_per_page=3');?>
<?php while (have_posts()): the_post(); ?>
<span class="subtours">Last Updated: <?php site_last_updated('') ?></span><br/><br/>
<span class="hoteltitle"><?php the_title(); ?></span>
<span class="bodytext"><?php the_excerpt(); ?></span>
<?php endwhile; ?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum