0

I'm trying to include an onclick javascript inside php but I can't get it to work properly. The link will open in a new tab on the browser but not in a new window which is what the Javascript does.

I believe I have escaped the single quotes correctly which is what I thought the problem might be.

See the php code below.

$image = sprintf( '<div class="wpcp-slide-image"><a onclick="window.open(this.href, \'left=20,top=20,resizable=0\'); return false;" href="'.$custom_notification_data.'">%1$s</a></div>', $post_thumb, get_the_permalink() );
2
  • Why are you using JavaScript to do this? Also, this has nothing to do with WordPress. Mar 9, 2021 at 2:13
  • Valid point. Will post this in stack overflow. Mar 9, 2021 at 2:41

0

Your Answer

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

Browse other questions tagged or ask your own question.