• I would like to use like a “post header excerpt”.
    How do I do?

    Like this:
    The original header, that shows on single.php:
    “This is a really long post header”
    The header that shows on index.php:
    “This is a really…”

    Please help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Change the_content( into the_excerpt( in your index.php.

    Peter

    Thread Starter nissepop

    (@nissepop)

    I’ve allready done that.
    I want to “shorten” the header (<?php the_title(); ?>).

    ???

    Ah, you mean the title?

    <?php echo substr($post->post_title,19) . "..."; ?>

    Peter

    Thread Starter nissepop

    (@nissepop)

    Thank you, but we aint there yet…
    <?php echo substr($post->post_title,19) . “…”; ?> cuts the title from the wrong direction… From the beginning.
    Like this

    Original title:
    “This is a really long post header”
    With yout script:
    “ng post header…”

    😉

    ah, apologies:

    <?php echo substr($post->post_title,0,19) . "..."; ?>

    Peter

    You should make it conditional, btw, or you’ll always stuck with those ‘…’:

    <?php
      if (strlen($post->post_title) >= 19 )
        echo substr($post->post_title,0,19) . "...";
      else
        echo $post->post_title;
    ?>

    Peter

    Thread Starter nissepop

    (@nissepop)

    Oh! Thank you very much!

    Nils

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Header excerpt’ is closed to new replies.