WordPress.org

Ideas

the_excerpt() and the_permalink() force the echo command - Should be optional

  1. bnettles
    Member

    When customizing themes for special functionality, sometimes you don't want the echo command called - you want the value so you can use as you deem appropriate. Currently you do not have the option with the_excerpt() and with the_permalink(). I had to modify these two functions deeper within the code so as to pass in the false value and not get the echo command. I will have to change this again when I do upgrades unless someone adds it to the code.

    post-template.php
    /**
    * Display the post excerpt.
    *
    * @since 0.71
    * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt.
    */
    function the_excerpt($deprecated_echo = true) {
    if($deprecated_echo)
    {
    echo apply_filters('the_excerpt', get_the_excerpt());
    }
    else
    {
    return apply_filters('the_excerpt', get_the_excerpt());
    }
    }

    link-template.php
    /**
    * Display the permalink for the current post.
    *
    * @since 1.2.0
    * @uses apply_filters() Calls 'the_permalink' filter on the permalink string.
    */
    function the_permalink($deprecated_echo = true) {
    if($deprecated_echo)
    {
    echo apply_filters('the_permalink', get_permalink());
    }else
    {
    return apply_filters('the_permalink', get_permalink());
    }
    }

    Posted: 10 years ago #
  2. Jeremy Massel
    Inactive

    try calling get_the_excerpt() or get_permalink() instead. Should give you the results you're looking for

    Posted: 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    0 Votes
  • Status

    Sorry, not right now

No tags yet.