Forums

WordPress Driven Homepage (7 posts)

  1. revlimiter
    Member
    Posted 2 years ago #

    Hi everyone,
    I am wondering how to enable WP control over my homepage on http://www.kimstewart.ca

    It is currently a static file (home.php) and it needs to be that way. I am just hoping there is some code I can add into the static file to enable CMS control over the content area.

    For example, I have added a page within WordPress called "Home", so in the content area of my home.php file, can I just write "<?php include home ?>" (for example) to do this?

    This is in theory of course, I don't know the exact code to do this...

    Thanks!

  2. Roy
    Member
    Posted 2 years ago #

    In the WP admin: "settings"->"reading" and make a "page" as index.

  3. revlimiter
    Member
    Posted 2 years ago #

    Hi Gangleri,

    This method won't work for me. It messes with the blog search / pagination. I need to upload a static php file (home.php) into my root folder (public_html) in order to have my static homepage. I am just wondering if I can still allow CMS control over this static homepage file.

    Hope this makes sense!
    Thanks

  4. revlimiter
    Member
    Posted 2 years ago #

    bump?

  5. Maxaud
    Member
    Posted 2 years ago #

    create a page template with your current php code and apply that to a page created in WordPress. This will make it wordpress but without integrating the WordPress loop into your php file, you cannot modify the contents.

  6. revlimiter
    Member
    Posted 2 years ago #

    Hey maxaud,
    Thanks for the reply.
    So if I'm understanding correctly... I can't retain WP control over my WordPress homepage using the methods above? ("/public_html/home.php")

    Thanks!

  7. Maxaud
    Member
    Posted 2 years ago #

    It's possible. Try adding this to your home.php page:

    <?php
    // Starts WordPress and tells it not to use your theme
    define('WP_USE_THEMES', false);
    require('/wp-blog-header.php');
    
    // retrieves page 2 only
    // alternatively you can use pagename=home
    // to get the page you want
    query_posts('page_id=2');
    ?>

    Next, find where you want the post to be and insert this code to insert it:

    <?php while (have_posts()): the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endwhile; ?>

    Continued Reading:
    query posts:
    http://codex.wordpress.org/Template_Tags/query_posts

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.