So what i mean is if i install wordpress in a folder in my website called news then can i pull in the latest post to my index.html in the root of the website?
so i have
index.html news/wordpress blog about us.html etc etc etc
So the blog is separate from the rest of the site but i need to pull the latest post in somehow?
You’ll find it’s an easier task if you just have the entire website as a WordPress install. WordPress has the capability to create an entire site, not just a blog. If you do it that way, your solution is trivial to implement.
If you have to have the WordPress installation separate, you could use this method – of course, you’d need to use PHP , not just a regular HTML file: http://codex.wordpress.org/Integrating_WordPress_with_Your_Website
Hope that helps
You can include Wordpress code on any arbitrary page by including wp-load.php. Then you just have to create a WP_Query object. So if your blog is in www.domain.com/news, and your home page is www.domain.com/index.php, you would just add the following to index.php:
<?php $path_to_wp = dirname(__FILE__)."/news"; require_once( $path_to_wp.'/wp-load.php' ); do your Wordpress stuff here ?>
Look up http://codex.wordpress.org/Function_Reference/WP_Query for details on creating a query to get your recent posts.
Alternatively, you could use PHP on the index to fetch the RSS feed from Wordpress.
Thanks guys your tips helped alot, i have managed to sort this now.
I added this above everything in the homepage…
<?php /* Short and sweet */ define(‘WP_USE_THEMES’, false); require(‘news/wp-blog-header.php’); ?>
and then this where i wanted the post to display…
<?php query_posts('showposts=1'); ?> <?php while (have_posts()) : the_post(); ?> <div class="blogimg"><?php getImage('1'); ?></div> <h4 class="blogtitle"><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h4> <p class="blogcopy"><?php the_excerpt(); ?></p> <a href="<?php the_permalink() ?>" class="readmore">read more</a> <?php endwhile;?>this works great.
- Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
- Open a support ticket if you would like specific help with your account, deposits or purchases.
- Item Support by authors is optional and may vary. Please see the Support tab on each item page.
Most of all, enjoy your time here. Thank you for being a valued Envato community member.