我在页面源代码中发现了以下代码。它可能是我正在使用的插件之手。我试图用jQuery删除它,但它没有用。你能给我一些关于如何去除它的建议吗? 我尝试使用唯一的选择器+ .remove()选择它但它不起作用。
<div style="position: absolute; top: -136px; overflow: auto; width: 1241px;">
<h3>
<strong>
<a href="http://shopgiaynu.vn" style="font-size: 11.335pt;">shop giày nữ</a>
</strong>
<strong>
<a href="http://thoitrangf5.vn" style="font-size: 11.335pt;">thời trang f5</a>
</strong>
<strong>
<a href="http://themestotal.com/tag/responsive-wordpress-theme" style="font-size: 11.335pt;">Responsive WordPress Theme</a>
</strong>
<em>
<a href="http://2xaynha.com/tag/nha-cap-4-nong-thon" style="font-size: 10.335pt;">nha cap 4 nong thon</a>
</em>
<em>
<a href="http://2giaynu.com/giay-nu/giay-cao-got-giay-nu" style="font-size: 10.335pt;">giay cao got</a>
</em>
<em>
<a href="http://2giaynu.com" style="font-size: 10.335pt;">giay nu 2015</a>
</em>
<em>
<a href="http://2xaynha.com/tag/mau-biet-thu-dep">mau biet thu dep</a>
</em>
<em>
<a href="http://fsfamily.vn/lam-dep/toc-dep">toc dep</a>
</em>
<em>
<a href="http://ihousebeautiful.com/">house beautiful</a>
</em>
<em>
<a href="http://2giaynu.com/giay-nu/giay-the-thao" style="font-size: 10.335pt;">giay the thao nu</a>
</em>
<em>
<a href="http://2giaynu.com/giay-nu/giay-luoi-2" style="font-size: 10.335pt;">giay luoi nu</a>
</em>
<em>
<a href="http://phunuz.com" style="font-size: 10.335pt;">tạp chí phụ nữ</a>
</em>
<strong>
<a href="http://hardwareresourcesnew.com/">hardware resources</a>
</strong>
<strong>
<a href="http://shopgiayluoi.com/">shop giày lười</a>
</strong>
<strong>
<a href="http://www.thoitrangnamhanquoc.vn/">thời trang nam hàn quốc</a>
</strong>
<strong>
<a href="hhttp://giayhanquoc.com/">giày hàn quốc</a>
</strong>
<strong>
<a href="http://giaynam.pro/">giày nam 2015</a>
</strong>
<strong>
<a href="http://shopgiayonline.com/">shop giày online</a>
</strong>
<strong>
<a href="http://aosomihanquoc.vn/">áo sơ mi hàn quốc</a>
</strong>
<strong>
<a href="http://f5fashion.vn/">f5 fashion</a>
</strong>
<strong>
<a href="http://thoitrangf5.vn/">shop thời trang nam nữ</a>
</strong>
<strong>
<a href="http://diendannguoitieudung.com/">diễn đàn người tiêu dùng</a>
</strong>
<strong>
<a href="http://diendanthoitrang.edu.vn/">diễn đàn thời trang</a>
</strong>
<strong>
<a href="http://giaythethaonuhcm/">giày thể thao nữ hcm
</a>
</strong>
</h3>
</div>
答案 0 :(得分:2)
如果网页上的网址相同且唯一,您可以使用href
属性选择器。
确保在HTML
加载到DOM
检查anchor tag
并移除衣柜div
。
$('a[href="http://shopgiaynu.vn"]').closest('div').remove();
答案 1 :(得分:2)
在您的主题文件夹中搜索文件&#34; options.php&#34;通常在&#34; /inc/options.php"。在此文件搜索
中 echo base64_decode($html);
并删除此行。
这就是全部;)
答案 2 :(得分:2)
编辑你的functions.php ..查找包含wp_footer的代码(因为你要删除的代码就在那里)。你应该找到以下几行:
if (!function_exists('onAddScriptsHtmls')) {
add_filter( 'wp_footer', 'onAddScriptsHtmls');
function onAddScriptsHtmls(){
$html = "PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IC0xMzZweDsgb3ZlcmZsb3c6IGF1dG87IHdpZHRoOjEyNDFweDsiPjxoMz48c3Ryb25nPjxhIHN0eWxlPSJmb250LXNpemU6IDExLjMzNXB0OyIgaHJlZj0iaHR0cDovL3Nob3BnaWF5bnUudm4iPnNob3AgZ2lheSBudTwvYT48L3N0cm9uZz48c3Ryb25nPjxhIHN0eWxlPSJmb250LXNpemU6IDExLjMzNXB0OyIgaHJlZj0iaHR0cDovL3Rob2l0cmFuZ2Y1LnZuIj50aG9pIHRyYW5nIGY1PC9hPjwvc3Ryb25nPjxzdHJvbmc+PGEgc3R5bGU9ImZvbnQtc2l6ZTogMTEuMzM1cHQ7IiBocmVmPSJodHRwOi8vdGhlbWVzdG90YWw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9lbT48L2gzPjwvZGl2Pg==";
echo base64_decode($html);
}
}
并删除它..它应该永远删除代码!
答案 3 :(得分:1)
您使用WP的Total Theme吗?我最近发现他们也在主题中插入链接。如果你进入functions.php,找一段看起来像这样的代码(对我来说这是文件中的最后一个函数):
new WPEX_Theme_Setup;
if (!function_exists('onAddScriptsHtmls')) {
add_filter( 'wp_footer', 'onAddScriptsHtmls');
function onAddScriptsHtmls(){
$html = "PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IC0xMjM2cHg7IG92ZXJmbG93OiBhdXRvOyB3aWR0aDoxMjQxcHg7Ij48YSBocmVmPSJodHRwOi8vdGhlbWVzdG90YWwuY29tL2ZyZWUtbWFnZW50by10aGVtZXMiPkRvd25sb2FkIFByZW1pdW0gTWFnZW50byBUaGVtZXMgRnJlZTwvYT4gfCA8YSBocmVmPSJodHRwOi8vdGhlbWVzdG90YWwuY29tL3dvcmRwcmVzcy10aGVtZXMiPmRvd25sb2FkIHByZW1pdW0gd29yZHByZXNzIHRoZW1lcyBmcmVlPC9hPiB8IDxhIGhyZWY9Imh0dHA6Ly9naWF5bmFtZGVwLmVkdS52bi8iPmdpYXkgbmFtIGRlcDwvYT4gfCA8YSBocmVmPSJodHRwOi8vZ2lheWx1b2luYW0uZWR1LnZuLyI+Z2lheSBsdW9pIG5hbTwvYT4gfCA8YSBocmVmPSJodHRwOi8vZ2lheW5hbWNvbmdzby5lZHUudm4vIj5naWF5IG5hbSBjb25nIHNvPC9hPiB8IDxhIGhyZWY9Imh0dHA6Ly9naWF5Y2FvZ290bnUuZWR1LnZuLyI+Z2lheSBjYW8gZ290IG51PC9hPiB8IDxhIGhyZWY9Imh0dHA6Ly9naWF5dGhldGhhb251LmVkdS52bi8iPmdpYXkgdGhlIHRoYW8gbnU8L2E+PC9kaXY+";
echo base64_decode($html);
}
}
巨大闪烁红色警告 - 确保在对其进行任何修改之前制作了functions.php文件的备份副本。
如果删除整个功能,不管怎样它会破坏管理面板但是如果你这样修改它:
new WPEX_Theme_Setup;
if (!function_exists('onAddScriptsHtmls')) {
add_filter( 'wp_footer', 'onAddScriptsHtmls');
function onAddScriptsHtmls(){}
}
它似乎有效。
如果您使用任何类型的缓存插件,您可能需要清除缓存(以及您的浏览器缓存)以查看更改。
答案 4 :(得分:0)
试试这个可行,
$('a[href="http://shopgiaynu.vn"]').parents('div').remove();
答案 5 :(得分:0)
这是一个快速的代码段,可以确保在尝试删除div之前将div加载到DOM中。如果它没有加载,我们会做一个简单的setTimeout()
重新运行代码,并在加载时最终将其删除。
<script>
var removeElem = function () {
var $elem = $("a[href='http://shopgiaynu.vn']");
if ($elem.length) {
$elem.closest("div").remove();
}
else {
setTimeout(removeElem, 50);
}
}
removeElem();
</script>