WordPress.org

Support

Support » How-To and Troubleshooting » Sample of a single post on static homepage

Sample of a single post on static homepage

  • particlepat
    Member

    @particlepat

    Hi I’m trying to create a simple snippet of my most recent post on my homepage in a designated container. I want the title to be displayed using <h1> and then in smaller italics I want it to show the date it was posted and the authors real name, not id. Then I want the post to show a small excerpt of the actual post with a link at the bottom that says Read the rest of this post and of course at the bottom, the number of comments and a link to Share Your Thoughts.

    Can somebody please help me out with the code and possibly break it down for me so that I can learn how it was done?

Viewing 4 replies - 1 through 4 (of 4 total)
  • particlepat
    Member

    @particlepat

    i’m having trouble with this still, can anyone help?

    particlepat
    Member

    @particlepat

    This is where I’ve gotten, I need to show only the most recent post on this particular page. http://www.bcsprosoft.com/blog

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

    <div class=”topPost”>
    <h1 class=”topTitle”>“><?php the_title(); ?></h1>
    <p class=”topMeta”>by <?php the_author_firstname(); ?> <?php the_author_lastname(); ?> on <?php the_time(‘M. d, Y’) ?>, under <?php the_category(‘, ‘); ?></p>

    <div class=”entry”>
    <?php the_excerpt(); ?>
    </div>

    particlepat
    Member

    @particlepat

    anyone?

    @mercime
    Participant

    @mercime

    Right after the_excerpt, you can add these (note – i added the span just in case you wanted to style the link – otherwise, delete the opening and closing spans

    <span class="read_on"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Continue Reading</a></span>
    <span class="comment"><?php comments_popup_link('Post a comment', 'One comment', '% comments', '', 'Comments off'); ?></span>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sample of a single post on static homepage’ is closed to new replies.