Forums

[resolved] want to change my blog front page ... (5 posts)

  1. fifthhouse
    Member
    Posted 1 year ago #

    My wordpress blog currently is set up to display the full text on the most recent post, and an excerpt that I create in the post input page for all other posts.

    I would like to change it so that the most recent post is the same as all the other posts. I want all the posts to display a certain length of the post, including images if they are in the beginning of the post.

    Is it possible for someone to tell me now to do this, or is it too complicated? I'm pasting in my index.php file:

    <?php get_header(); ?>

    <div id="content">
    <?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('Index Top Right')):?>
    <?php endif;?>
    <div class="index-block">
    <?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('Video Spot')):?>
    <?php endif;?>
    </div>
    <h2 class="section_title">Most Recent Posts</h2>
    <?php $c=0;?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php $c++;?>
    <div id="post-<?php the_ID(); ?>" class="post">
    <h2 class="title">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <p class="meta author"><?php the_time('F jS, Y') ?></span><b>  </b>
    </p>
    <div class="entry">
    <?php if( $c==1 ) the_content();
    else the_excerpt('...Read more »'); ?>
    </div>
    <p class="bottom-meta" style="text-align:right;margin:0;">
    <?php comments_popup_link('Add Your Comments', '1 Comment', '% Comments', 'comments'); ?>
    </p>
    <?php if (function_exists('sharethis_button')) { sharethis_button(); } ?>
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <span><?php next_posts_link('« Previous Entries') ?></span> |
    <span><?php previous_posts_link('Next Entries »') ?></span>
    </div>

    <?php else : ?>

    <div class="post">
    <h1 class="title">Not Found</h1>
    <div class="entry">
    <p>Sorry, but you are looking for something that isn't here.</p>
    </div>
    </div>

    <?php endif; ?>

    </div>
    <!-- end content -->

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  2. Les Bessant
    Moderator
    Posted 1 year ago #

    If you have a look at this section:

    <div class="entry">
    <?php if( $c==1 ) the_content();
    else the_excerpt('...Read more »'); ?>
    </div>

    Try changing it to:

    <div class="entry">
    <?php the_excerpt('...Read more »'); ?>
    </div>

    Make sure to keep a backup of the file as it is now, in case something goes wrong, or you want to change it back.

  3. fifthhouse
    Member
    Posted 1 year ago #

    Thanks Les!! That did the trick :)

  4. fifthhouse
    Member
    Posted 1 year ago #

    Ooops I just realized that the problem is only partially solved. The most recent post is now displaying an automatically generated excerpt, but the posts are not displaying the image, which is at the top of the post. Also, I have youtube videos which are not displaying in the excerpt. Is there a way to have the image and the youtube url display the video as in the full post?

  5. fifthhouse
    Member
    Posted 1 year ago #

    Sorry about that, I just figured it all out. I changed the_excerpt to the_content, and then inserted a 'more' in the post. All fixed up now.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.