treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Wordpress Read Article / Comment »

  • I notice on the css-tricks front page on a post it says 'Read Article / Comment »' and it goes to a div of more but it only shows when there is more content. how do you do that?
  • the front page is stealing an excerpt from the loop, so basically, there is a page made for the full post, but on the home page he is stealing the excerpt.

    on a page you want the excerpt it needds to be a php page and have this at the top:

    <?php
    // Include Wordpress
    define('WP_USE_THEMES', false);
    require('/path to your header/wp-blog-header.php');
    query_posts('showposts=1');// 1 or more
    ?>


    then somewhere on that page you want to show the excerpt, then place this in your page:

    <!-- mini loop for the excerpts -->
    <?php while (have_posts()): the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_excerpt(); ?>
    <p><a href=\"<?php the_permalink(); ?>\">Read more...</a></p>
    <?php endwhile; ?>
    <!-- end the mini loop -->
  • Thanks :D :D