WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] the_excerpt (5 posts)

  1. intcon
    Member
    Posted 2 years ago #

    Hi..

    I've read where you change the_excerpt into the_content to change blog posts to show the entire post instead of just an excerpt..

    here's what my code in index.php says

    <div class="post-content">
      		          <?php $post_excerpt = of_get_option('post_excerpt'); ?>
      		      		<?php if ($post_excerpt=='true' || $post_excerpt=='') { ?>
      		            <div class="excerpt"><?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,45);?>

    which excerpt do i change?

    thanks!

    carrie

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    your posted section is only part of a possibly more relevant code;

    can you poast the full code of that template?
    (see forum guidelines for posting code)

  3. intcon
    Member
    Posted 2 years ago #

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    in the most simple case, try and replace this section:

    <?php $post_excerpt = of_get_option('post_excerpt'); ?>
                                    <?php if ($post_excerpt=='true' || $post_excerpt=='') { ?>
                                <div class="excerpt"><?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,45);?></div>
                              <?php } ?>

    with:

    <div class="excerpt"><?php the_content(); ?></div>

    OR alternatively (experimental as I don't know exactly what the theme option does):

    there seems to be a theme option to select to show the excerpt or nothing; if you want to keep this and change it to excerpt or content, then change the section to:

    <?php $post_excerpt = of_get_option('post_excerpt'); ?>
                                    <?php if ($post_excerpt=='true' || $post_excerpt=='') { ?>
                                <div class="excerpt"><?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,45);?></div>
                              <?php }
    else { ?>
    <div class="excerpt"><?php the_content(); ?></div>
    <?php } ?>
  5. intcon
    Member
    Posted 2 years ago #

    woohoo!! the first one worked...thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.