Forums

Calling the_title inside an echo (4 posts)

  1. bongkph
    Member
    Posted 8 months ago #

    Hi, Can someone help me to call the_title inside an echo?

    if($sample !== '') echo 'This story is about (the_title) . $sample .'</p>';

    Thanks

  2. NateJacobs
    Member
    Posted 8 months ago #

    the_title() already displays the title. There is no need to use echo.

    <p>This story is about <?php if ( $sample != '' ) the_title(); echo $sample; ?></p>

  3. alchymyth
    The Sweeper
    Posted 8 months ago #

    the_title() has the 'echo' parameter for not to echo the title:
    http://codex.wordpress.org/Function_Reference/the_title

    or use
    get_the_title()

    http://codex.wordpress.org/Function_Reference/get_the_title

  4. bongkph
    Member
    Posted 8 months ago #

    Thanks to you guys. I still have one more thing, probably the last with regards to custom field. I think I should post it separately.

Reply

You must log in to post.

About this Topic

Tags