I am using Yii 1.1 in a project where I need to fetch the top blog titles from a wordpress site. I am using the following code for this. On using this however, I am getting 404 for all pages when this layout is being used. I am not able to understand how this is affecting the final status code. Commenting out this specific block removes all error.
I was actually okay with the 404 till it start messing with some vital javscript files.
spl_autoload_unregister(array('YiiBase','autoload'));
require_once('./blog/wp-blog-header.php');
spl_autoload_register(array('YiiBase','autoload'));
$recent_posts = wp_get_recent_posts(array(
'numberposts' => 10,
'post_type'=>'post',
'post_status'=>'publish'
));
foreach($recent_posts as $post) {
echo '<li><a href="', get_permalink($post['ID']), '">', $post['post_title'], '</a></li>';
}
The file ./blog/wp-blog-header.php
exists and I am able to list down the blog articles using the above code. It is just the status code that is causing trouble.