2017-02-27 152 views

回答

1

您可以通过添加做到这一点下面到你的主题functions.php或你的插件代码:

add_action('wp_footer', 'add_new_element'); 

function add_new_element() { 
    echo '<a href="google.com"><img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"></a>'; 
} 

它会闭幕前插入链接body标签

+1

谢谢!如果我有一个JavaScript代码taht我想在body标签再次 –

+0

感谢增加,对不起,我应该寻找它很容易找到taht –

+0

不用担心的JS,必须从某个地方开始:) – Und3rTow

0
function your_function() 
{ 
    echo '<p>This is inserted at the bottom</p>'; 
} 

add_action('wp_footer', 'your_function'); 

代码放在功能.php文件的活动儿童主题(或主题)。或者也可以在任何插件php文件中使用。

参考:wp_footer

希望这有助于!

1

使用此功能。 See more in WordPress codex

<?php 
 
function your_function() { 
 
    echo '<p>This is inserted at the bottom</p>'; 
 
} 
 
add_action('wp_footer', 'your_function'); 
 
?>