• Hi Guys,

    I have developed my website and converted my template to a WordPress theme. Now, I just want my 5 most recent posts on my homepage (which is in the root folder), but do not know how to get outside “the loop” because WordPress is installed in /blog/.

    Any idea how this can be achieved?

    Thanks,
    Amnesia

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Amnesia180

    (@amnesia180)

    I have read through this and am still a little confused.

    I don’t want to turn any of my website (apart from the blog itself) into a WP theme (which I do not think that tutorial is telling me to do anyway).

    My website is in HTML, so to fix this… I assume I just need to change the *.htm extensions to *.php ?

    Am I right in saying that to implement the last 3 posts (without content, just titles so they can click on them) I need to do the following:
    Put this before the </head> tag:

    // Get the last 3 posts.
    <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>

    Then this where I want the content to appear?

    <?php query_posts('showposts=3'); ?>
    <?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;?>

    I just need to put a direct link to the blog header at the top?

    Many thanks!
    Amnesia

    change the file extension .htm to .php. Put this `<?php
    require(‘blog/wp-blog-header.php’);
    ?>
    `
    at the top(before the<!DOCTYPE not </head> tag).

    Thread Starter Amnesia180

    (@amnesia180)

    Hi there,

    I have done this and I get the following critical errors:

    Warning: require() [function.require]: URL file-access is disabled in the server configuration in /home/a1827545/public_html/index.php on line 2
    
    Free Web Hosting
    
    PHP Error Message
    
    Warning: require(https://www.genuinefreebies.co.uk/blog/wp-blog-header.php) [function.require]: failed to open stream: no suitable wrapper could be found in /home/a1827545/public_html/index.php on line 2
    
    Free Web Hosting
    
    PHP Error Message
    
    Fatal error: require() [function.require]: Failed opening required 'https://www.genuinefreebies.co.uk/blog/wp-blog-header.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a1827545/public_html/index.php on line 2

    Thread Starter Amnesia180

    (@amnesia180)

    Bump.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Content Outside "The Loop"’ is closed to new replies.