Forums

[resolved] the_title(); shows only first word in Title (3 posts)

  1. arifbd111
    Member
    Posted 8 months ago #

    Hi Experts..

    I am in a little problem. I am trying to add a code for Tweet button. I used this code for the button
    <a href="https://twitter.com/share" class="twitter-share-button" data-text=<?php the_title(); ?> data-count="horizontal" data-via="arifulhbhuiyan">Tweet</a>

    here data-text=<?php the_title(); ?> is responsible to show the text in Twitter shutter window. but in the share window i find only the first word from the title appear.

    What could be problem? and how to solve? :(

  2. smartobject2
    Member
    Posted 8 months ago #

    I think you need double quotes around the data-text value?
    data-text="<?php the_title(); ?>"

    Cheers,
    Lee

  3. arifbd111
    Member
    Posted 8 months ago #

    Thanks smartobject2!

    Your solution worked fine :D

Reply

You must log in to post.

About this Topic