Forums

[resolved] Add a variable to wordpress function (4 posts)

  1. newkind
    Member
    Posted 2 years ago #

    Hi,

    I'd like to assing a variable to function ie.

    $something = the_excerpt();

    but everytime i do so, the_excerpt is automatically generated by wordpress ... how can i declare such variable without executing this function ?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    If in a 'standard post loop', try $post->post_excerpt.

  3. Mark / t31os
    Moderator
    Posted 2 years ago #

    It's proberly because..
    the_excerpt();
    Returns it's value...

    Use..
    get_the_excerpt()
    Example..
    $myvar = get_the_excerpt();

    ** Or perhaps Michael's suggestion.. **

    ;)

  4. newkind
    Member
    Posted 2 years ago #

    thank you all for your replies :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.