Forums

Static WordPress "Page" as Landing Page for Site (24 posts)

  1. ClimbingMonkey
    Member
    Posted 6 years ago #

    After an exhaustive search through the archives, I’m at a loss and am in need of guidance. Oh and I can get wordy so bear with me please, this is my effort to be complete. My site is here: http://www.marcnjami.com

    Goal: Make a wordpress page that functions as a landing page for my site, (kinda CMS like) but do this in a manner so I can still leverage the native index.php for my blog. I’m also trying to touch the core wordpress files as little as possible so it is easier to maintain and I can leverage this theme on different sites. When I get this solved I can promote wordpress to my root directory and complete the total transition to wordpress. Yea!!!!

    Progress: My theme is coming along nicely and I nice archives page. I also have successfully integrated Gallery2 into wordpress. I have created the page and basic template I want to use as the “landing� page (i.e. http://www.marcnjami.com/wordpress/?page_id=1). I have tried various solutions such as Ryan’s pagetofront plug-in, renaming my home page template to home.php to leverage the wordpress template hierarchy and Alex’s WordPress as a CMS hacks. Oh and I’ve done a truckload of reading and research.

    Problem: I need to accomplish this in a platform independent way without using permalinks or url rewrites because I leverage a W.I.M.P. platform and hence no apache. With any of the above solutions I can’t seem to access the index.php page directly. If you go to my site you will notice the horizontal navigation bar under the header. From an end user perspective when I click on home (or go to http://www.marcnjami.com/wordpress/ for that matter), I want to go to above mentioned “static� page. When I click on “is this a weblog?� I want to arrive at my blog (i.e. index.php).

    Any thoughts on how I might be able to get this to work? Oh and I play in the shallow end of the pool when it comes to php so be easy on me. Lol…

  2. James
    Happiness Engineer
    Posted 6 years ago #

  3. Root
    Member
    Posted 6 years ago #

    I stand by my home.php as front page solution but it needs to be implemented correctly. By the look of things you have bits of your set up in a sub directory. Using home.php that is unnecessary. That way any click on a link will go by default to index php or down the hierarchy if you have other templates installed. All you need do then is tweak the blog link on home.php to a slightly different url.

  4. ClimbingMonkey
    Member
    Posted 6 years ago #

    macmanx - So I have already taken a look at the Semilogic plugin. From a quick glance it seems to me that it does the exact same thing as Ryan's page-to-front plugin. it just looks for a page slug instead of an ID. Am I wrong?

    root - you are right. I currently have an "entry" page in the root of my web and wordpress and gallery installed in subdirectories. My goal is to have a wordpress managed "entry" page so I can promote my wordpress dir to the root. So are you saying that I use home.php as my front page and rename my index.php file to something else? I don't think I'm quite understanding your point...

  5. Root
    Member
    Posted 6 years ago #

    You would save index php as home php. So now you have 2 files. At the moment they would be identical. The difference is the way they load. A call to your url will bring up home php (your new home page). Any other click brings up index php. So now any changes you make to home.php do not affect the remainder of your blog. You can edit the loop, swap CSS, add / subtract columns - dispense with posts - whatever in home.php. As to urls the Home url in your nav needs to be the domain url and the Blog link needs to point to /index.php specifically. Really simple. No redirects. No plugins. No hacks. No conditional php. See my blog for a live example.

  6. IanD
    Member
    Posted 6 years ago #

    Any other click brings up index php
    Root, one thing to note - as far as I can tell, if you use the next/previous page links on home.php, page2 etc still calls home.php and not index.php.

  7. Root
    Member
    Posted 6 years ago #

    That would make sense.

  8. ClimbingMonkey
    Member
    Posted 6 years ago #

    Okay, I have done as you suggested. Same problem...

    I renamed my homepage.php template to home.php (I had already tried this btw) If you go to my wordpress 1.5 install: wordpress you can now see my "landing page." Now try this url: index.php . You see the issue? The templating system has a built in hierarchy that tells it to load home if is available, if not load index. Since I have a home.php in my template dir it will never load index.php!

    It my issue clearer now? Oh and I've also tried renaming my index.php page to blog.php and I get nothing but a blank page.

    What am I missing?

  9. TechGnome
    Moderator
    Posted 6 years ago #

    Riiiight.... index.php will be used when you start viewing individual posts, or go into the categories, or the archives..... If you go straight into index.php, you haven't specified a specific post or anything to view, so it loads home.php by default....

    Which, if you think about it, makes sense. as http://mysite.com/ is the same as http://mysite.com/index.php

    Tg

  10. ClimbingMonkey
    Member
    Posted 6 years ago #

    Absolutely... Makes perfect sense. So can I create a page that will display all my posts (the same functionality as index.php)? I have tried to copy index.php -> blog.php and then I called the rewind function at the beginning of the page and still no luck getting all my posts. As I stated earlier I play in the shallow end of the php pool, so I'm learning as I go along! :)

  11. Root
    Member
    Posted 6 years ago #

    Well now you just need to edit home php. Seems to be working fine unless I am missing something.They look the same because they re the same. Alternatively as I indicated in my post and others have picked up you need to edit the url to point to index.But the template hierarchy only kicks in if no file is specified. index php should do it. IMHO.

  12. ClimbingMonkey
    Member
    Posted 6 years ago #

    My home and index files are different...

    Home is a customized page template I made that only loads the content of page one and customized wide nav bar. Index loads a list of all my posts, the standard sidebar, in typical blog format.

    With a home.php and an index.php in my wordpress theme directory, when I change the link to point to index.php directly, the templating heirachy is seeming to kick in and still uses the layout and content contained in the home.php file. It sees http://mysite.com/ the same as http://mysite.com/index.php and then it says yep this "is_home()" go ahead and use the home.php cause it is there... :)

    I see what you are trying to say but in my experience the template hierarchy does kicks in even if I specify a link to index.php directly. Bummer...

  13. Root
    Member
    Posted 6 years ago #

    Well Ok - just think a bit. Alter the url for the blog (index) to include a cat for example.

  14. ClimbingMonkey
    Member
    Posted 6 years ago #

    I figured it out... I needed to add home.php to my list of default documents (in IIS) for my wordpress directory. It was setup to load home first BEFORE index.php. This was the key...

    So I configed the directory in IIS, and copied my homepage file to home.php in the root of wordpress. It sat next to my gallery2 integration file and my archives page. That did the trick.

    See for yourself: http://www.marcnjami.com/wordpress/

    Thanks much for your patience :)

  15. Jinsan
    Member
    Posted 6 years ago #

    If I click the links in activity, they don't do anything other than refresh the page. I take it they should display the posts?

  16. Root
    Member
    Posted 6 years ago #

    Well you never mentioned IIS :). Glad you got fixed up.

  17. ClimbingMonkey
    Member
    Posted 6 years ago #

    Yep they should... the side effect of this is that the post and cat queries are being routed without specificity to index.php. My home page only knows how to display page_id=1. Uggggg... a never ending process it seems...

  18. Root
    Member
    Posted 6 years ago #

    Well I did not understand your expo. WP needs to load home.php before index.php. These are in the same directory are they ? This is extremely simple. Something obvious has gone wrong.And what the heck is page 1 ?

  19. ClimbingMonkey
    Member
    Posted 6 years ago #

    yes, the same dir... and you are correct wp loads home.php before index. And wp uses IT to display my wp queries. This is what I'm trying to avoid.

    My home.php file displays the content of pageID 1 only. (a page to front solution) It also displays a simple widebar at the bottom of that page content. My index.php however displays my preset number of posts, and should have a sidebar with different contents.

    When WP routes a query it goes through home.php (because WP or ishome() sees yoursite\ the same as: yoursite\index.php) and since home.php exists the templating system uses it to "process" the query.

    In my case, when having both home and index in my template dir, This results in 5 posts with my widebar at the bottom (the home.php template) when I want to have my sidebar instead (as is contained in my index.php file).

    With all this said... If you go to my site: http:\\www.marcnjami.com you will see what the end result should look like. I ended up yanking my home, gallery and archives files and putting them in seperate directories. WordPress themed and content driven "external" pages if you will. Since my new "landing" page is external from the wordpress dir and yet knows where it is, it can still get content and theme info.

    Messy and not ideal but it is doing what it is told for now.

  20. Denis de Bernardy
    Member
    Posted 6 years ago #

    ClimbingMonkey -- actually there is a difference with Ryan's plugin:

    - Ryans plugin detects if you're _going to be_ on the front page. If so, it changes the page's _parameters_, and adds an ID. Thereon, your page answers to is_page() and uses page.php

    - My plugin bypasses the main loop's query _after_ WP detects you're on the front page. So your page answers to is_home() and uses home.php

    That said, my plugin is not for the php hacker. It's just for the average Joe who needs an easy to implement solution. Create a page titled Home, and activate the plugin -- I trust you cannot get more simple that.

    If you know what you're doing, you might as well write a genuine home.php file. As point out by Root, just rewrite home.php entirely and include any or all necessary loops that you need. But I'd suggest you use a plugin based on mine to weck the WP loop if you do (insert a WHERE 1 = 0 clause). Just to spare your SQL server a few useless queries per visitor.

  21. Root
    Member
    Posted 6 years ago #

    This can be so easy to manipulate if we think laterally and think in terms of admin. A cat query will look for a cat file. If all else fails it loads index php not home. So the url from home could be a cat (call it recent). for example. Put your last five posts in there. Obviously for the set up you want home and index are configured differently. One does not have the menu etc, and the loop is different.
    This should be really simple.

  22. BayArea_Brian
    Member
    Posted 6 years ago #

    OK, So I Want To Try a New Home.php as well. What I want to get to is essentially a list of categories, matching colors and the header logo. (readers may often want to go to a topic directly instead of 'the latest post').
    But when I go to duplicate index.php from my wp 1.5 pages, I see ONLY the terse and undoubtedly clever:
    <?php define('WP_USE_THEMES', true);
    require('./wp-blog-header.php'); ?>
    SO that leaves me with a big NADA to customize the homepage from - I don't know any PHP, although I programmed in C for many years.

    thanks in advance for any pointers

  23. ClimbingMonkey
    Member
    Posted 6 years ago #

    After some time, I have revisited this and I've finally seen the light. (Right?)

    When you create a new post it defaults to "uncategorized" right? The WP template order for cat calls is category-BLAH.php then category.php archive.php then index.php. (See here: http://codex.wordpress.org/Category_Templates) Lets say I made a category.php template file that had the same code as index and set all my posts to be under the uncategorized cat AND a more specific cat. So each post would now be in 2 cats right? I could make my link to my blog be this: http://www.yoursite.com/wordpress/?cat=1 and that should grab every post and display it using the category.php template. Make sense? If you are a apache user I imagine you could url_rewrite ?cat=1 -> /blog or something like that then you have pretty urls. Since I run IIS/Windows I don't have this luxury :(

    Since I didn't figure this out until I got and email from another user with the same goal, here's what I did... And YES my home page is WP managed! :)

    My root dir contains an index.php and a custom header and footer. My index file grabs my wp stuff <?php require_once('wordpress/wp-blog-header.php');?> and then my custom header <?php include_once('header.php');?>. Then it grabs the page with the id of 1 and does all the activity, page and cat grabbing. Then I import my custom footer. Walla!

    I did this for my g2 page and my archives as well. Now I have prettier urls (gallery, archives and wordpress all live in seperate dirs under my root btw) and they are all themed with the DEFAULT template. I put that in caps because this approach doesn't play well with theme switching. When you grab wp-blog-header.php it only really knows what theme is the default as opposed to a switched theme. I don't really see a need for me to use theme switching anyhow, so it works great for me.

    Thank you to everyone that held my hand through this process. I appreciate your time and hopefully this might help others in the community. :)

    Cheers!

  24. Root
    Member
    Posted 6 years ago #

    Well you finally got straight. Denis' plugin seems a very nifty tool for the home page manouever. Is home would be ideal. And heck why not have more plugins. :)

Topic Closed

This topic has been closed to new replies.

About this Topic