• Resolved erboy

    (@erboy)


    I am using adcenter ads, which are as- https://ads.ad-center.com/offer?prod=101&ref=5030200&q=Keyword.
    Now i want to replace Keyword in link with post title automatically. i have tried this code, but it return first word from title, code is-

    <?php
     $title = get_the_title();
     echo "<a href=https://ads.ad-center.com/offer?prod=101&ref=5030200&q=$title >Download</a>"
    ?>

    please solve it or tell me other method to add title in link automatically.
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • You are welcome, I would try it like this:

    <?php
    
    // yours
     $title = get_the_title();
     echo "<a href=https://ads.ad-center.com/offer?prod=101&ref=5030200&q=$title >Download</a>"
    
     // mine
     $title = get_the_title();
     echo '<a href="https://ads.ad-center.com/offer?prod=101&ref=5030200&q=' . $title . '">Download</a>';
    
    ?>

    Thread Starter erboy

    (@erboy)

    Thanks santeven very much. It’s working

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘problem in adding post title in link’ is closed to new replies.