0

If I have a post with a spacing in it (like: Hello World), than get_the_title shows me only "Hello" as a link and not the whole permalink. I already tried using a substring to get it done, but it did not work out for me. Am I missing here something?

I just used get_the_title(); and put it in a variable.

Code:

<?php
$titletest = get_the_title();

echo " <a href=http://www.testungsss.com/search?q=$titletest>$titletest</a> ";
?>
2
  • 1
    show us your code.
    – Milo
    Jun 16 '13 at 16:28
  • There is not much to show really. I updated my code. Jun 16 '13 at 16:38
3

Your title isn't correctly encoded for use in a query variable. Try this:

echo ' <a href="http://www.testungsss.com/search?q=' . urlencode($titletest) . '">' . $titletest . '</a>';
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.