WordPress.org

Forums

Truncating Archive, Search and Category Pages (4 posts)

  1. craftilyeverash
    Member
    Posted 1 year ago #

    I am trying to truncate my archives, categories and search results pages. I want to leave my home page as full posts. I have read A LOT of forum posts, but most refer to changing (the_content) to (the_excerpt). Unfortunately my theme (a very modified Matala) doesn't have those anywhere to be found. I am a beginner at CSS modification, so I need an easy explanation. Thank you so much!!!

    http://www.mycraftilyeverafter.com

  2. vtxyzzy
    Member
    Posted 1 year ago #

    The function the_content() is found in 5 places in the unmodified theme:

    • content.php
    • content-status.php
    • content-gallery.php
    • image.php
    • page.php
  3. craftilyeverash
    Member
    Posted 1 year ago #

    But how do I change it in just the archives, search and category pages? Thank you!

  4. vtxyzzy
    Member
    Posted 1 year ago #

    Sorry, I thought from your comment about a highly modified theme that you would know that - my mistake.

    This is untested, so be sure you have a backup of the content.php file, and can use either ftp or a file manager to correct any errors.

    Try changing this line (from the unmodified content.php):

    <?php the_content( __( 'Read the rest of this entry <span class="meta-nav">→</span>', 'matala' ) ); ?>

    to this:

    <?php
       if ( is_archive() || is_search() ) {
          the_excerpt();
       } else {
          the_content( __( 'Read the rest of this entry <span class="meta-nav">→</span>', 'matala' ) );
       }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic