Grow your CSS skills. Land your dream job.

[Solved] Having WP Posts on Home page as well as blog page

  • # September 2, 2009 at 4:15 pm

    I’m having a bit of trouble. I mocked up a site that has 2 post from its blog on the home page. but i want it so that the blog actally lives on its blog page. if that makes any since. Its very simalry to elliot jay stocks home page. He has on there recently from his blog. and then when you click blog. It has his blog with out all the other junk from the home page. If you check out his page im sure it will make a more since what im talk ing about.

    http://elliotjaystocks.com/

    # September 2, 2009 at 5:04 pm

    ok, well you have to have this php in your main index page or the one you want the wordpress to go into:

    this must be the very first thing in your php file

    Code:
    < ?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require('/your_servers_script_address/blog/wp-blog-header.php');
    query_posts('showposts=1');
    ?>

    and have this in your page somewhere

    Code:

    < ?php while (have_posts()): the_post(); ?>

    < ?php the_title(); ?>

    < ?php the_excerpt(); ?>

    ” class=”red”>Read more…

    < ?php endwhile; ?>

    that is an excerpt from your last post

    # September 2, 2009 at 6:13 pm

    Ok i did what you said however its not really working. Here check it out

    The website is maddesignskillz.com
    and the blog is at maddesignskillz.com/blog

    The blog post is suppose to go right under the text talking about who they are.

    # September 3, 2009 at 5:08 am

    I hope you used your scripting path???

    Code:
    < ?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require('/your_servers_script_address/blog/wp-blog-header.php');
    query_posts('showposts=1');
    ?>

    in this line you must have your own scripting path, I just added in dubiuos text: require(‘/your_servers_script_address/blog/wp-blog-header.php’);

    it might actually look something like the following but remember this is something like mine, although not exactly:require(‘/home/fhlinux172/w/abc.co.uk/user/htdocs/blog/wp-blog-header.php’);

    so find out what your exact scripting path is and make sure you take it all the way to the wp-blog-header.php

    Ah….. this is your problem:
    Warning: require(/public_html/blog/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/mad/public_html/wp-content/themes/starkers/index.php on line 4

    I will explain:
    you have this in your code:
    require(/public_html/blog/wp-blog-header.php)

    but your server is looking for this:
    require(/home/mad/public_html/wp-content/themes/starkers/index.php)

    now I don’t know how you set up your wordpress but I would guess you have it on your main server at root level and not within its own directory the way I have mine, so I guess you will need:
    require(/home/mad/public_html/wp-blog-header.php)

    have a lok at your wordpress foot code on your index.php what is the path to that? this should explain why it is not working. However, remember make sure it is to your wp-blog-header.php

    # September 3, 2009 at 11:50 am

    Thanks man I got it working

    # September 3, 2009 at 11:55 am

    well done, you just need to style it to make it fit your design

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".