August 24, 200917 yr Have been trying to work around this for weeks and I am so stuck. My site is in HTML/CSS. I created a blog theme in Wordpress to match my site and I'm pleased with the way it turned out. All I want to do is display the last 3 posts on the index page. My index page is currently a htm file, but I've read I will need to make it a php file in order for this to work. So I've changed the extension, followed numerous tuts and it will not work. The blog is up and running fine http://www.edenstreet.net/blog The page I'm using to embed the posts is currently http://www.edenstreet.net/test.php Any help or pointers as to where I'm going wrong would be appreciated. Apart from contact forms I'm a PHP newbie!
August 24, 200917 yr you will need to connect to the wordpress database, so have <?php require('.blog/wp-blog-header.php'); ?> at the top of the oa now on the page add <?php $recent = new WP_Query("showposts=3"); while($recent->have_posts()) : $recent->the_post();?> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt(); ?> <?php endwhile; ?> that should work, but untested
August 24, 200917 yr Author Thanks for your reply. That was near to the code I was using. For some reason it's not working. The page doesn't even seem to be recognising the require function.
August 24, 200917 yr go and ask at the wordpress forums at www.wordpress.org as they will have a lot more knowledge about this, it may be that the code is slightly out
August 24, 200917 yr Author Thanks again. I posted on the forum a while ago but no one replied. Will keep trying.
August 24, 200917 yr Code I've used successfully is <?php // Include Wordpress define('WP_USE_THEMES', false); require('./wordpress/wp-blog-header.php'); query_posts('showposts=10'); ?> <!-- mini loop for the excerpts --> <?php while (have_posts()): the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_excerpt(); ?> <p><a href="<?php the_permalink(); ?>" class="text1">Read more...</a></p> <?php endwhile; ?> <!-- end the mini loop --> edit - just looked at your page it shows < ?php require('/blog/wp-content/themes/edenstreet/header.php'); ?> try using <?php require('./blog/wp-content/themes/edenstreet/header.php'); ?>
August 25, 200917 yr Author Thanks for your reply. I made the change, which I think I've done before. I've tried so many tuts. Now the page has just gone blank white. I think there must be something wrong with my configuration. The blog works fine on its own, other php files work on the server. I really don't know what is wrong with it.
Create an account or sign in to comment