• Resolved vex

    (@vex)


    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

    (@vex)

    No one knows?

    Include the “wp-blog-header.php” file.

    Thread Starter vex

    (@vex)

    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

    (@vex)

    i fixed it…

    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

    (@vex)

    I got it including the file. Now it skips a line on my page 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.