WordPress.org

Ready to get started?Download WordPress

Forums

Change Excerpt "Continue reading" link to External Link (4 posts)

  1. wieceka
    Member
    Posted 1 year ago #

    Having some trouble here:

    Trying to have the "Continue Reading" link out to an external site. Got it to work for the title and images of the post using a new function, but having an issue with the excerpt "continue reading" link.

    /**
     * Returns a "Continue Reading" link for excerpts
     */
    function twentyeleven_continue_reading_link() {
    	return ' <a href="'. get_homestay_link() . '">' . __( 'View this property <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
    }

    That's my new code in functions.php.

    But instead of changing the link, it inserts that link at the top of the excerpt and then the link directs to the homepage. Wierd. Any suggestions?

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the function get_homestay_link() would need to return the link, not echo it;

    can you post the full code of that function?

  3. wieceka
    Member
    Posted 1 year ago #

    That was exactly it! Thank you!

    The function was echoing the link instead of returning it.

    Thank you!

  4. jaydokie
    Member
    Posted 1 year ago #

    What do you mean by "return the link, not echo it;" I want an excerpt with the external link at http://roundhousetalk.com which presently comes up "Read full story here" underneath the second post titled "Treasury and the IRS Release Tribal General Welfare Guidance". You can click the title and it takes you to the external post, but clicking on the "Read full story here" links you to a permalink post on my site which then requires that the reader click on the "via" link to get to the external post. It sounds like you all corrected it in this forum post but I am not sure how you did it.

Topic Closed

This topic has been closed to new replies.

About this Topic