Grow your CSS skills. Land your dream job.

Single post on page?

  • # January 8, 2009 at 10:57 pm

    Can anyone share with me how to set up my home page so that it only shows one post of my blog (the most recent post) with a continue reading link… What code to I change to do that? What I want is to have ONLY the most recent post on my home page then have a link in the navigation for Blog.. then that page would show the whole blog list.. however many post I allow to be shown on a page. Does that make sense?

    So I guess I need to know how to do both. how to I make another page show the whole blog rather than the home page, but have the home page show just one most recent post.

    as an example I kind of like how this guy set his up, he put the rest of his posts in an archive.

    Thanks

    # January 8, 2009 at 11:49 pm

    There is a setting in Settings > Reading for how many posts you want to show =)

    # January 9, 2009 at 10:50 am

    ha, wow its right there, thanks.

    ya know.. Im working hard to learn wordpress to use as the CMS of my portfolio/design business site. I wanted to learn it so things were easily changed, updated.. etc but what do i do? I keep looking for the hard way to do things when what I want and am looking or is right under my nose in the WP admin panel.

    Im used to learning all the hard stuff now I need to realize that some of it is now just the easy stuff that WP will do it for me.

    Thanks Chris

    # January 9, 2009 at 11:03 am

    Im still unsure of how to have one post on my home page.. and then all, or atlest more than 1 displayed on my blog page… hmmmm. I could keep my home page as my post page and set it to show one , but then how would I get my blog page to show an archive or, 5+ of my post..

    Or I could set my blog page to show posts, but then how do I get a section that shows only my most recent post. The setting in WP allows me to only do part. from what I can tell.

    # January 9, 2009 at 12:30 pm

    hi Lin,

    make your home page a static page, or a page in wordpress;

    ok in your index.php page, start the code with:

    Code:
    < ?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require('/address-to-your-header-is-different-to-mine/wp-blog-header.php');
    query_posts('showposts=1');
    ?>

    then wherever you want your excerpt of the most recent post put this piece of PHP:

    Code:

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

    < ?php the_title(); ?>

    < ?php the_excerpt(); ?>

    ” class=”text1″>Read more…

    < ?php endwhile; ?>

    edit: i believe you can change the_excerpt() to the_post() if you want the full post on that page

    but on your blog page make as many posts visible as you like.

    mind you this is only an excerpt check out what it should look like with the "update on pfs" under News heading in this link:
    http://www.pfs-ifa.co.uk/index.php

    # January 9, 2009 at 5:08 pm

    hmmmm thats not quite working. but maybe Im doing it wrong. I want the home page to have the snippet of one/most recent post, and the blog page to have the whole blog.. so if I read your instructions right that had me putting both sets of code you gave in the index.php file..

    I tried other combinations too but no luck.

    # January 9, 2009 at 5:15 pm
    "LinCSS25" wrote:
    hmmmm thats not quite working. but maybe Im doing it wrong. I want the home page to have the snippet of one/most recent post, and the blog page to have the whole blog.. so if I read your instructions right that had me putting both sets of code you gave in the index.php file..

    I tried other combinations too but no luck.

    no sorry my bad for not explaining fully.

    I have a site that has index.php and that is static, not wordpress’ index.php, that has the snippets of code I gave. I could have made this home.php but it has to be a php file.

    my blog/wordpress is in a directory called resources, so really my index.php is not in wordpress, but I would take it the mini loop could be put into any page through wordpress. I can see why you are confused. in the resources/wordpress directory there is another index.php but only for that directory (wordpress’ index.php)

    edit: go to that site I linked to the pfs one, and click on the links at the very top, then look at your address bar, they are all index.php files in that site

    # January 10, 2009 at 11:09 am

    You might want to try a query_posts. http://codex.wordpress.org/Template_Tags/query_posts

    You can save this as your home.php and set wordpress to display this as a static home page.

    Example:

    Code:
    < ?php
    // display only one post
    query_posts('showposts=1');

    global $more;
    // set $more to 0 in order to only get the first part of the post
    $more = 0;

    // the Loop
    while (have_posts()) : the_post();
    // the content of the post
    the_content('Read the full post »');
    endwhile;
    ?>

    # January 14, 2009 at 1:50 pm

    How do I get WP to recongize the new Home.php file I made so I can set it as static under settings? It seems to only show Pages I made through it as options to choose from.

    Can anyone just step me through how to do this? Im failing big time. missing something.
    How do I set a static home page (where does it need to be in my server directory), where do I put what code, and what setting do I set up in the admin panel?

    Thanks so much

    # January 14, 2009 at 3:28 pm
    "LinCSS25" wrote:
    How do I get WP to recongize the new Home.php file I made so I can set it as static under settings? It seems to only show Pages I made through it as options to choose from.

    Can anyone just step me through how to do this? Im failing big time. missing something.
    How do I set a static home page (where does it need to be in my server directory), where do I put what code, and what setting do I set up in the admin panel?

    Thanks so much

    Lin,

    where is you wp set? e.g. http://www.lin.co.uk/ or http://www.lin.co.uk/blog (or http://www.lin.co.uk/wordpress)

    ik

    # January 14, 2009 at 3:32 pm

    the regular domain http://www.linkcreativedesign.com

    # January 14, 2009 at 3:37 pm
    "LinCSS25" wrote:

    so wordpress is there? not in its own directory?

    I think you will have to make a page like the home.php file, and select that as your single page

    I always put wordpress in its own directory so I can have more control over the sites I have done with it

    # January 14, 2009 at 3:38 pm

    right.. do you think I should have it in its own for what Im wanting to do?

    # January 14, 2009 at 3:44 pm
    "LinCSS25" wrote:
    right.. do you think I should have it in its own for what Im wanting to do?

    from the full thread, I think your wanting a static home page then be able to link into wordpress.

    I would.

    I added wordpress 2.7 to my kung fu site. I put wordpress into a directory called blog.

    but my home page links into it.

    I know earlier you got confused about my index.php example, but what I was trying to show you there was that you can still access the wordpress loop from outside the wordpress directory.

    see if this is what your looking to achieve linking wise: http://www.woskf.co.uk

    # January 14, 2009 at 3:53 pm

    yes that is it! front page shows the most recent post. they are calling it news.. Im not sure i will call it that, prob just most recent blog post. then a page that shows all the blog posts.. or however many you set to show on a page.

Viewing 15 posts - 1 through 15 (of 25 total)

You must be logged in to reply to this topic.

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