• Resolved jLuneyWP

    (@jluneywp)


    Hello all,
    I’m fairly new to wordpress (read: I’ve never used it before) I have designed our company website at mainly using .html and dreamweaver. It is hosted by a company called Data Emporium, who have installed our wordpress blog at abraxasarchitecture.com/news. I designed that page in dreamweaver using the php file type, so it would have the same layout and look as the rest of the page. I then used the code:

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    ?>
    
     <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>
      <?php query_posts('showposts=10'); ?>
      <?php while (have_posts()) : the_post(); ?>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
      <?php the_title(); ?>
      </a><br />
      <?php endwhile;?>

    Which was supposed to grab the last 10 posts and then display them in the page I designed. it doesn’t though. the page now just displays this error message:

    Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/abralune/public_html/News.php on line 4

    Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/abralune/public_html/News.php on line 4

    Fatal error: require() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/abralune/public_html/News.php on line 4

    So I get that I need a ‘./wp-blog-header.php’ file, but what needs to be included in there? Where do I need to save it/ how does it link to my news page? Is there any way to just edit the code so it doesn’t require a header and will just use the layout and header I already designed?
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Try this:

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', false);
    require('./news/wp-blog-header.php');
    ?>

    And obviously require('/the/path/to/your/wp-blog-header.php'); would be redundant after that ??

    Thread Starter jLuneyWP

    (@jluneywp)

    Hmm well that didn’t work….
    Now instead of displaying an error message it just displays all of the code for that page.
    I saved the ‘news.php’ file in the root of the site, while all of the wordpress set up files are saved in a ‘news’ file. Could this be a problem? Also, I never defined a wp-header.php- I was under the impression that this was just one of the standard wordpress files the page refers back to to load the blog, is that correct?
    Also- I didn’t change the second part of the code-

    <!--Get the last 10 posts. -->
      <?php query_posts('showposts=10'); ?>
      <?php while (have_posts()) : the_post(); ?>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
      <?php the_title(); ?>
      </a><br />
      <?php endwhile;?>

    Is that part correct?
    I’ve got lots of questions- thanks for any advice y’all may have…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Well … It has to be in a .php file, not a .html file.

    You can’t have php code in an html file (though you CAN have HTML code in a PHP file)

    Thread Starter jLuneyWP

    (@jluneywp)

    Oh! Ok it decided to work now. Thanks for your help, I think that little change fixed it!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘displaying wordpress posts in a .html site’ is closed to new replies.