Title: help including functions&#8230;.
Last modified: August 18, 2016

---

# help including functions….

 *  Resolved [vex](https://wordpress.org/support/users/vex/)
 * (@vex)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/)
 * I have a file news.php in staff/wp-content/themes/default/news.php and I included
   it into my index.php on my site. I get this error when loading the site.
 * Fatal error: Call to undefined function: have_posts() in /home/vxlabs/public_html/
   staff/wp-content/themes/default/news.php on line 1
 * Does anyone know what file I need to include in my news.php for it to display
   my posts on the homepage?
 * heres my news.php code
 * ‘<?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
 *  <div class=”chead” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title
   =”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>
   </h2>
    <small
   ><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>
 *  <div class=”cbody”>
    <?php the_content(‘Read the rest of this entry »’); ?> 
   </div>
 *  <p>Filed under <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”,‘
   | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments»’);?
   ></p>
    </div>
 *  <?php endwhile; ?>
    <?php else : ?> <div class=”chead”> <h2>Not Found</h2> </
   div> <div class=”cbody”> <p>Sorry, but you are looking for something that isn’t
   here.</p> </div> <div class=”cfoot”> </div>
 * <?php endif; ?>’

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [vex](https://wordpress.org/support/users/vex/)
 * (@vex)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507236)
 * No one knows?
 *  [Pizdin Dim](https://wordpress.org/support/users/pizdin_dim/)
 * (@pizdin_dim)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507238)
 * Include the “wp-blog-header.php” file.
 *  Thread Starter [vex](https://wordpress.org/support/users/vex/)
 * (@vex)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507241)
 * now I get this
 * ‘Warning: main(/staff/wp-blog-header.php) [function.main]: failed to open stream:
   No such file or directory in /home/vxlabs/public_html/staff/wp-content/themes/
   default/news.php on line 1
 * Warning: main(/staff/wp-blog-header.php) [function.main]: failed to open stream:
   No such file or directory in /home/vxlabs/public_html/staff/wp-content/themes/
   default/news.php on line 1
 * Warning: main() [function.include]: Failed opening ‘/staff/wp-blog-header.php’
   for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/vxlabs/
   public_html/staff/wp-content/themes/default/news.php on line 1
 * Fatal error: Call to undefined function: have_posts() in /home/vxlabs/public_html/
   staff/wp-content/themes/default/news.php on line 2′
 * my news.php file is in staff/wp-content/themes/default/news.php
 * heres news.php
 * ‘<?php include(“/staff/wp-blog-header.php”); ?>
    <?php if (have_posts()) : ?>
   <?php while (have_posts()) : the_post(); ?>
 *  <div class=”chead” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title
   =”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>
   </h2>
    <small
   ><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>
 *  <div class=”cbody”>
    <?php the_content(‘Read the rest of this entry »’); ?> 
   </div>
 *  <p>Filed under <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”,‘
   | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments»’);?
   ></p>
    </div>
 *  <?php endwhile; ?>
    <?php else : ?> <div class=”chead”> <h2>Not Found</h2> </
   div> <div class=”cbody”> <p>Sorry, but you are looking for something that isn’t
   here.</p> </div> <div class=”cfoot”> </div>
 * <?php endif; ?>’
 *  Thread Starter [vex](https://wordpress.org/support/users/vex/)
 * (@vex)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507243)
 * i fixed it…
 *  [Pizdin Dim](https://wordpress.org/support/users/pizdin_dim/)
 * (@pizdin_dim)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507245)
 * From what I can see about your directory structure, you need:
 * `include('/home/vxlabs/public_html/staff/blog-header.php');`
 * Is that what you have?
 *  Thread Starter [vex](https://wordpress.org/support/users/vex/)
 * (@vex)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507253)
 * I got it including the file. Now it skips a line on my page [http://vxlabs.com](http://vxlabs.com)
 * the blue line isn’t suppose to be there. I can’t fix that. I think it’s something
   to do with the <p> </p> tags

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘help including functions….’ is closed to new replies.

 * 6 replies
 * 2 participants
 * Last reply from: [vex](https://wordpress.org/support/users/vex/)
 * Last activity: [19 years, 3 months ago](https://wordpress.org/support/topic/help-including-functions/#post-507253)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
