Support » Localhost Installs » renaming index.php

  • Hi all,

    I have WordPress installed on my server and it all works fine.
    If I go to my index.php it displays all my blogs as expected.

    I am trying to pull my blogs into a different php page with little luck.

    I have been researching this for some time now. I have read i a lot of placed that is you make it WordPress ready and add the loop it should work.

    i add require(‘wp-blog-header.php’); – this works.

    however the loop cannot find any of my posts.
    If i past exactly the same code into index.php it works.
    So as soon as the file name is changes it can not find my posts.

    Any help on this would be hugely appreciated!


Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi


    Forum Moderator

    Is this page part of your WP site?

    Hi esmi,

    Thanks for the response…

    No it is a separate php page.
    I have however made some progress….
    The loop I was using which seems to be everywhere I look when researching did not have a $posts = get_posts query.
    I found an alternative loop which does and I am now populating the page (in a fashion!)
    I’m now trying to work out how to format (theme) my content .
    Any ideas if it would be better to customize the theme using css within the separate php page or define a customized theme with in wp?
    Im not sore what the benefits would be either way.




    Forum Moderator

    I’m not sure if there is a better way here. It’s really down to what suits your needs best. If you intend to just have this one page showing posts, then I’d say that using CSS on that page would be the better option. If, however, people will be able to click on a link to see the single Posts, you might want to look at developing a customised theme. It’s a bigger job but would be the best approach if you want a seamless visual look to all of your pages.

    Yes that does make sense.

    I have had a loo at defining a theme using
    define(‘WP_USE_THEMES’, true);
    at the start but it displays the theme but states it cannot find any posts

    “Not Found

    It looks like nothing was found at this location. Maybe try a search?”

    however if you then scroll down to underneath the footer it then displays my posts..

    have you seen this happen before?

    Thanks again!!



    Forum Moderator

    Drop a copy of the file into the pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Yes please share your code that you are using for the page. May be there’s something missing which we can correct.

    Thanks guys!

    Here is a link to the output

    and here is the code

    define(‘WP_USE_THEMES’, true);
    * @package WordPress
    * @subpackage Default_Theme

    //get_header(); ?>

    <link href=”css/wordPressEmb.css” rel=”stylesheet” type=”text/css”>

    <div id=”sidebar2″>
    <?php get_sidebar(‘right’); ?>

    $posts = get_posts(‘numberposts=10&order=DESC&orderby=post_title’);

    foreach ($posts as $post) : setup_postdata( $post ); ?>
    <div id=”date”>
    <?php the_date(); echo “
    “; ?>
    <div id=”content”>
    <?php the_content(); ?>



    Thanks again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘renaming index.php’ is closed to new replies.