将 simplemodal 与 wordpress 结合使用
我正在尝试使用 simplemodal 在 WordPress 帖子中使用带有文本的模式弹出窗口。我尝试过各种插件,但它们有特定的用途(例如联系表单,或我看到的另一个显示您可以自定义的单个注释的插件)。
我尝试按照本教程进行操作: http:// /wordpressthemescollection.com/ajax-wordpress-post-popup-with-simplemodal-and-jquery-488.html 但对于没有高级 jquery 或 wordpress 知识的人来说,说明不是很清楚,而且它根本不起作用为我。例如,作者没有解释将该函数放在哪里。
对于任何在 WordPress 中使用 simplemodal 工作而无需开发插件的人,您能提供帮助吗?谢谢。
I am trying to use simplemodal to have modal popups with text in wordpress posts. I've played around with various plugins but they have specific uses (such as the contact form, or another one I saw that displays a single note you can customize).
I've tried following this tutorial: http://wordpressthemescollection.com/ajax-wordpress-post-popup-with-simplemodal-and-jquery-488.html but the instructions are not very clear for people without advanced jquery or wordpress knowledge and it simply isn't working for me. The author does not explain where you put the function, for instance.
For anyone who's gotten simplemodal working in wordpress, without developing a plugin, can you please assist? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
本教程是解决方案的良好开端,但并未提供所有详细信息。我还会做出一些改变。下面是我要让它工作的方法:
postpopup
类,并且在中具有帖子 ID >rel
属性。js/
文件夹js/
文件夹中site.js
)并将其放在js/
文件夹中site.js
中:。
functions.php
文件中:。
这应该可以让它为你工作。确保主题的页脚中有
wp_footer()
函数。我重新设计了模态窗口的调用方式,以便内容自动居中。The tutorial is a good start on a solution, but does not quite provide all of the details. There are also some changes that I would make. Here is what I would do to get it working:
postpopup
class and has the post ID in therel
attribute.js/
folder in your theme directoryjs/
foldersite.js
) and place it in thejs/
foldersite.js
:.
functions.php
file:.
That should get it working for you. Make sure you have the
wp_footer()
function in your theme's footer. I re-worked the way the modal window was being called so that the auto-centering of the content works.