문제

I've added following code for the URL:

<a href='http://facebook.com/share.php?u="<?php urlencode(the_permalink()); ?>"&amp;t="<?php urlencode(the_title()); ?>"' target="_blank"><i class="icon-facebook"></i><?php _e('Facebook', 'domain'); ?></a>

It generates this output:

<a href='http://facebook.com/share.php?u="http://example.com/abc/"&amp;t="Lorem ipsum dolor sit amet"' target="_blank"><i class="icon-facebook"></i>Facebook</a>

But I get error in the validation:

Bad value http://facebook.com/share.php?u="http://example.com/abc/"&t="Lorem ipsum dolor sit amet" for attribute href on element a: Illegal character in query: not a URL code point.

How can I fix this error? Thanks.

도움이 되었습니까?

해결책

Do not use " in url. Your link element format should be like;

<a href="http://www.domain.com?a=john" target="_blank">User</a>

You can refer here for html link format, and you can use this;

<a href="http://facebook.com/share.php?u=<?php urlencode(the_permalink()); ?>&amp;t=<?php urlencode(the_title()); ?>" target="_blank"><i class="icon-facebook"></i><?php _e('Facebook', 'domain'); ?></a>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top