Changing src URL on page id

Instead of saying “its not working” it would be more informative to describe what’s happening.

You should first put the iFrame URL into a variable ratther than writing the iFram HTML code twice:

<?php

$page_id = get_queried_object_id();

// default iFrame src
$iFrameSrc = "URL A";

if($page_id == 5232) {
    $iFrameSrc = "URL B";
}
?>

<iframe src="<?php echo $iFrameSrc;?>" width="90%" height="550" type="text/html" frameborder="0" allowTransparency="true" style="border: 0; overflow: hidden; margin-top: -30px;"></iframe>

This should work. If it doesn’t you may explore the possible reasons:

  • add echo $page_id; to check the received id
  • ensure the modal content is not cached by any system

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)