• Resolved markp

    (@markp)


    Hi all,

    In WP1.5 we have the new option to create Pages not just Posts.

    What I want to do is create a Page which will be the site’s home page. When users go to the site I want them to see that page.

    I’ve tried a few things. I’m already managing to get the site home page to appear in the Page template (as in default Kubrick) and not the Posts template (or any other template) by fiddling with the end of wp-blog-header.php:
    } else if ( is_home() && file_exists(get_page_template()) ) {
    include(get_page_template());
    exit;

    but it still shows the latest posts and not the page. I’ve tried writing the ‘ID’ of the page into a variable but I’m getting nowhere there either.

    Any ideas?

    I’m imagining that this type of setting might just become a standard option in the admin console.

    I’m using build ‘wordpress-2005-01-17’

    Cheers,

    Mark

Viewing 11 replies - 61 through 71 (of 71 total)
  • “and then just put the loop in there and create it as a page.”

    How do I “create it as a page”?

    Give a brief description of what you want and where you are, I don’t want to read all 3 pages of posts and probably still not be able to figure out what you are asking to do. ??

    I did it!

    The Spotlight home page (index.php)

    The Spotlight Blog

    Now, I basically did the same thing as mxtrader, but I didn’t realize that until I was halfway into it. I didn’t understand his until then, and I did things differently. I think my files are different, because the deleting lines thing didn’t line up with what was in my files.

    First things first, we don’t need the plugin. Don’t install it. or deactivate it. (Imagine that?)

    1. Copy the text or file from the Main Index template and save it as (root/)blog.php or (root)/blog/index.php
      (You can add this to give it a name:)

      <?php
      /*
      Template Name: Blog Home
      */
      ?>

    2. Move the text from the Page to index.php template (Main Template), replacing the Loop, but keeping the content divs, etc. Make sure your divs are closed.
      Also make sure that you don’t have the RunPHP plugin code (instead of php code) in the file (if you’d already made the page with PHP code. Nevermind if you don’t know.)
    3. Copy (root/)wp-blog-header.php and save it as wp-index-header.php (I find this easier and quite accurate.) Leave it as is.
    4. Open wp-blog-header.php and change this code:
    5. Comment out:
      } else if ( is_home() && get_home_template() ) {
      include(get_home_template());
      exit;

      (On mine, it is on line: 220)

      Leave it on the same line, it should look like:
      //} else if ( is_home() && get_home_template() ) { include(get_home_template()); exit;

    6. Search for “index” and replace with “blog”. Or (on mine) on line: 245 (right near the end):
      Make sure the url reads:

      } else if ( file_exists(TEMPLATEPATH . “/blog.php”) ) {
      include(TEMPLATEPATH . “/blog.php”);
      exit;
      }

      Of course, if your blog url is different, make it match. It could be: “/blog/index.php”

    7. Copy (root/)index.php into the blog file (blog.php) and change the settings to:
      define(‘WP_USE_THEMES’, false);
      require(‘./wp-blog-header.php’);

      Note the “false,” I believe that really did the trick. I could be doubling things with still commenting out that line, but I believe this was the only combination that worked. There’s probably some more correct way. But hey! ??

    8. Back to index.php, change setting to:
      require(‘./wp-index-header.php’);
    9. Upload:
      root/blog.php
      root/index.php
      root/wp-index-header.php
      root/wp-blog-header.php
    10. And then of course, add the link into your header, sidedbar, or wherever. ??

    Phew! Come see mine. Everything works!

    Now, I have the little problem of my footer now showing up on the main page. The code is the same as the others.

    For now, I’ll include the actual text.

    Okay, apparantly, “it” (below) needs to be set to “true.” It worked before, but after fixing other site issues, it only works on true. I don’t understand this coding thing, seems fickle to me! ??

    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);

    And the footer was because I didn’t notice that the fine lady who wrote my theme included the footer quite a bit before the sidebar is included. It was different to me. (Starburst Theme)

    OK, I’ve read this whole thread and some others discussing the same topic. I still need help:
    1. WordPress is installed in the root.
    2. I have a static WP page set as the site’s homepage. I am using Semiologic plugin.

    The question is: how can I access the regular blog page?

    Now that my blog is older, I’ve noticed that “next” pages / “page 2” will not work after my blog.php page. https://www.kissmestace.com/thespotlight/blog.php/page/2/ It says No input file specified. If I type in changing blog to index, it still doesn’t work. This makes sense, but I don’t know how to fix it.

    ColourDreamer’s fix worked perfectly for me, that’s exactly what I wanted, thank you!

    I want to add, however, that it will give you incorrect results for is_home(). For me personally I only wanted is_home() returning true for the main page (root/) and not for the journal index (root/journal/) so here was my fix:

    In classes.php there is this line, that is the test for whether or not is_home returns true:

    if ( ! ($this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {

    which in mine was around line 200. Right before that line add this:

    $journal = false;
    if(strstr($_SERVER[‘PHP_SELF’], ‘journal/’)) {
    $journal = true;
    }

    Make sure you change “journal/” to whatever your journal page is set to – and change the original to this:

    if ( ! ($this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $journal)) {

    Basically just have to add another condition of the test, checking to see if journal/ (or whatever your page/subdirectory is called) is in the URL or not.

    Does everybody else have their pages (page/2) working properly? What did you do?

    ruddo

    (@ruddo)

    I created a new technique to get a static WordPress home page that does not require plugins or hacks, just a drop of a file in your theme folder. Hope you like it.

    ruddo

    (@ruddo)

    My technique does let the blog pages work OK.

Viewing 11 replies - 61 through 71 (of 71 total)
  • The topic ‘WP Page as static home page’ is closed to new replies.