Forums

WP Page as static home page (72 posts)

  1. ColourDreamer
    Member
    Posted 6 years ago #

    No answer for allowing PHP on a page?

  2. ColourDreamer
    Member
    Posted 6 years ago #

    "and then just put the loop in there and create it as a page."

    How do I "create it as a page"?

  3. Beel
    Member
    Posted 6 years ago #

    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. ;-)

  4. ColourDreamer
    Member
    Posted 6 years ago #

    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!

  5. ColourDreamer
    Member
    Posted 6 years ago #

    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.

  6. ColourDreamer
    Member
    Posted 6 years ago #

    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)

  7. Tudor
    Member
    Posted 6 years ago #

    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?

  8. ColourDreamer
    Member
    Posted 6 years ago #

    Now that my blog is older, I've noticed that "next" pages / "page 2" will not work after my blog.php page. http://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.

  9. lunarmagic
    Member
    Posted 6 years ago #

    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.

  10. ColourDreamer
    Member
    Posted 6 years ago #

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

  11. RuddO
    Member
    Posted 5 years ago #

    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.

  12. RuddO
    Member
    Posted 5 years ago #

    My technique does let the blog pages work OK.

Topic Closed

This topic has been closed to new replies.

About this Topic