0

I have in the theme file single.php a link in it (example.com/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.com/cars/?aff=' target='_blank'>";

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

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

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

Would be glad about help!

Regards

1 Answer 1

0

I think this is what you are trying to accomplish?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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