admin管理员组

文章数量:1410730

I have in the theme file single.php a link in it (example/cars/?aff=) in each post of my blog is displayed. That's how I integrated it:

$html .="<a id='test' rel='nofollow' href='/?aff=' target='_blank'>";

I would like the title of the post to be automatically written behind ?aff=

For example: /?aff=POSTTITLE

How do I accomplish this? Have googled allot but cannot find anything.

Would be glad about help!

Regards

I have in the theme file single.php a link in it (example/cars/?aff=) in each post of my blog is displayed. That's how I integrated it:

$html .="<a id='test' rel='nofollow' href='https://example/cars/?aff=' target='_blank'>";

I would like the title of the post to be automatically written behind ?aff=

For example: https://example/cars/?aff=POSTTITLE

How do I accomplish this? Have googled allot but cannot find anything.

Would be glad about help!

Regards

Share Improve this question edited Dec 7, 2019 at 13:51 Elgoots 1626 bronze badges asked Dec 7, 2019 at 9:22 MikeMike 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

I think this is what you are trying to accomplish?

$html .="<a id='test' rel='nofollow' href='https://example/cars/?aff='". echo get_the_title( $post_id ) ." target='_blank'>";

本文标签: Post title as link parameter