Jump to content

How come feeding posts from sufolder not allowed?


Recommended Posts

This php script is driving me insane.

This is a simple script which pulls wordpress titles from news directory. It works if I put this code on homepage file.

But if I launch this script in a file that is in a sub folder then I get an error even though I do specify  require('../news/wp-blog-header.php'); to go back to top level.  If I insert the full http:// path, it doesnt work at all.

 

Does anyone know why?

 

 

<?php
// Include Wordpress 
define('WP_USE_THEMES', false);
require('news/wp-blog-header.php');
query_posts('showposts=3');
?><?php while (have_posts()): the_post(); ?>

<a href="<?php the_permalink(); ?>"><p class="border"><?php the_title(); ?></p></a>
<?php endwhile; ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.