Report lỗi khi thêm script này vào functions.php trong wordpress.

Hi Pro!
Mình đang tìm hiểu cách ẩn header của 1 trang web khi chèn bằng iframes thì có người cho đoạn code này , bảo add trong functions.php

function add_this_script_footer(){ ?>
<script type="text/javascript">
var isInIFrame = (window.location != window.parent.location);
if(isInIFrame==true){
alert("It's in an iFrame");
document.getElementById('header').style.display = "none";
}
else {
alert("It's NOT in an iFrame");
}
</script>
<?php }
add_action('wp_footer', 'add_this_script_footer'); ?>

Nhưng khi thêm vào thì site ko chạy đc, tất cả các link trong phần quản lý wordpress cũng ko hoạt động lun.
Pro nào biết cách khắc phục lỗi này thì liên hệ mình nhé, có hậu tạ a!
Thanks!
 

Announcements

Forum statistics

Threads
435,242
Messages
7,335,158
Members
186,681
Latest member
Vvhanh281
Back
Top Bottom