• Hi all, got a problem that I can’t figure out, I’m using the Miniml theme that I’ve customised. The default page when you visit the blog is home.php which is what I want it to be, but I would also like to link to index.php to show every post to the blog.

    How would I do this? Ideally I’d just like to add an “All Posts” link that points to index.php at the top of the blog where the page links are.

    http://eat.scm.tees.ac.uk/blog/

    Can someone point me in the right direction please?

    Rich

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter indie1982

    (@indie1982)

    Anyone?

    Well, the first step is to get your host to change the priority of your default documents such that home.php takes priority of index.php. All WordPress pages by default generate ‘http://eat.scm.tees.ac.uk/blog/’ as the URL to the home page, so that will make home.php come up then. Then you can add a link specifically to index.php for the traditional WordPress page.

    Have fun!

    [sig moderated]

    Thread Starter indie1982

    (@indie1982)

    Sorry, I don’t think I explained that enough there.

    I’m talking about the home.php and index.php files within a theme.

    In my theme I have home.php and index.php, from the docs I’ve read on themes I’ve gathered that if you only have an index.php in your theme then that is the default page but if you have a home.php and an index.php then home.php is the default page.

    Which is fine, exactly how I want it to work, however I want to be able to link to the index.php inside my theme as that shows all posts made to the blog in date order, my home.php shows posts based on category.

    I don’t see how I can link to the index.php as the resulting page is made up of header.php/footer.php/sidebar.php and index.php.

    http://eat.scm.tees.ac.uk/blog/ goes straight to our WordPress site and loads header/footer/home, I want to link to another page which loads header/footer/index/sidebar.

    Is this possible?

    Thread Starter indie1982

    (@indie1982)

    Anyone?

    Why not use the static front page ability? This FAQ explains one solution: How can I have a static front page and posts display on a page called Blog?

    indie1982,
    did you ever find a solution to this problem? I’m trying to figure out the same thing myself. i’ve designed a home page (home.php) that displays only the most recent post and i want a “buzz/news” page (index.php) to list all of the latest posts, just as a normal blog page would.

    Sounds exactly like what you were trying to do.

    Thanks for any help, if you’ve managed to solve this problem.

    What you are describing sounds more like an ‘Archive’ listing, in which case, I would create a custom archive.php Template.

    However, to answer your question…

    index.php will never be loaded if home.php is present and you can’t link directly to the index.php file in your theme.

    http://www.yourdomain.com/yourblog/index.php IS NOT the index.php from your Template. It is the root file of the core WordPress system.

    You need to put a loop in index.php that *ignores* the parameters passed to it in the URL. For example, if you go to http://www.yourdomain.com/yourblog/list (note: no .php) and provided you don’t have any Permalinks (e.g. Pages) called ‘list’ then WordPress will default to using index.php. A normal loop would look for ‘list’ and then return “Sorry, could not find what you are looking for.” However, if you write a loop that queries the database and returns all results, then you can use the Template Tags to creates a list of post titles and dates under monthly/yearly headings.

    If you do it the way I just described, then any URL that doesn’t exist will cause index.php to load with your custom loop.

    http://www.yourdomain.com/yourblog/mybiglist
    http://www.yourdomain.com/yourblog/archive
    http://www.yourdomain.com/yourblog/index

    Note: The last two have nothing to do with archive.php and index.php.

    I recommend instead creating a custom archives.php Template (note the ‘s’). Then create a new Page and call it ‘Archives’ with slug ‘archives’. Set the Template to archives.php. Now you can create a custom archive listing in whatever way you want. Non-existent URLs will still go to index.php where you can have an improved “Sorry, could not find what you are looking for.” page (e.g. related posts by tag/category, a search form).

    Some helpful links:
    http://wordpress.org/support/topic/223800?replies=4
    http://blogmum.com/2009/05/how-to-make-a-wordpress-archive-page/

    I just posted a solution similar to what you may be looking for over here:

    http://wordpress.org/support/topic/329195

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Using home.php as main page but linking to index.php’ is closed to new replies.