GG资源网

将占位符文本添加到WordPress wp-login.php页面

问题描述:

So I want to add placeholder text to the Username and Password fields on the standard wp-login.php page - I don\'t want to edit the actual wp-login.php page because every time WordPress is updated my amends will just be wiped.

So! In functions.php I\'ve added a simple function to add a .js file (and some css files but I don\'t think that\'s important for this) to the wp-login.php page where I have this code - here is my function in functions.php

And here is my js file

And this is where I get stuck .. in my mind that should work, I\'ve checked the IDs and they all seem to line up but I\'m clearly doing something wrong, you can see the page here http://www.camp-site-finder.com/wp-login.php

If you view the source you can see the link to my .js file and I\'m referencing jQuery so errmm, have I done something stupid along the way or is there a better way of doing this?

If anyone can point me in the right direction on this one I\'d be very grateful

N

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~
功能建议

所以我想在标准的wp-login.php页面上的“用户名”和“密码”字段中添加占位符文本 - I 不想编辑实际的wp-login.php页面,因为每次更新WordPress时我的修改都会被删除。</ p>

所以! 在functions.php中我添加了一个简单的函数来添加一个.js文件(以及一些css文件,但我认为这对此不重要)到wp-login.php页面,我有这段代码 - 这是我的 function.php中的函数</ p>

  function my_custom_login(){
echo\'&lt; link rel =“stylesheet”type =“text / css”href =“/ shared-assets /css/main-screen-styles.css“/&gt;\';
echo\'&lt; link rel =”stylesheet“type =”text / css“href =”\'。get_bloginfo(\'stylesheet_directory\')。\'/ css /campsite-finder-screen-styles.css“/&gt;\';
echo\'&lt; script type =”text / javascript“href =”/ shared-assets / js / test.js“&gt;
&lt; / 脚本&gt;\';
}
add_action(\'login_head\',\'my_custom_login\');
</ code> </ pre>

这是我的js文件</ p>

  jQuery(document).ready(function(){
jQuery(\'#user_login\')。attr(\'placeholder\',\'Name\');
jQuery(\'#user_email\')。attr( \'placeholder\',\'Email\');
jQuery(\'#user_pass\')。attr(\'placeholder\',\'Password\');
});
</ code> </ pre>

< 这就是我被卡住的地方..在我的脑海里 这应该工作,我已经检查了ID,他们似乎排队但我显然做错了,你可以看到这里的页面 http://www.camp-site-finder.com/wp-login.php </ p>

如果你 查看源代码,你可以看到我的.js文件的链接,我正在引用jQuery这么错误,我有没有做过一些愚蠢的事情或者有更好的方法吗?</ p>

如果有人能指出我正确的方向,我将非常感激</ p>

N </ p>
</ div>

网友观点:

you didn\'t include .JS file in <script src=\\\"something.js\\\"> . you have included it in <link rel=stylesheet > tag that\'s the problem i have found in your page

由于网站搬家,部分链接失效,如无法下载,请联系站长!谢谢支持!
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » 将占位符文本添加到WordPress wp-login.php页面

发表回复

CAPTCHAis initialing...
© 2021-GG资源网 - www.ggplus.cn. All rights reserved