I'm trying to display the most recent blog post on the homepage of a website that isn't wordpress, using php.
This is my code:
<?php require('../../../../../../../blog/wp-blog-header.php');
?>
<?php
$args = array( 'numberposts' => 3, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
$postslist = get_posts( $args );
echo '<ul id="latest_posts">';
foreach ($postslist as $post) : setup_postdata($post); ?>
<li><strong><?php the_date(); ?></strong><br />
<a href="<?php the_permalink(); ?>" title="<?php the_title();?>"> <?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
But I'm getting this error:
Fatal error: require(): Failed opening required '../../../../../../../blog/wp-blog-header.php' (include_path='/home/devbh/public_html/app/code/local:/home/devbh/public_html/app/code/community:/home/devbh/public_html/app/code/core:/home/devbh/public_html/lib:.:/usr/lib/php:/usr/local/lib/php') in /home/devbh/public_html/app/design/frontend/test1/default/template/page/hpBlog.phtml on line 35
I've made sure the filepath is correct so that shouldn't be the issue, but can't really think what else it could be? Any ideas?