B2主题网址导航- WordPress教程

效果展示

B2主题网址导航- WordPress教程插图

教程开始

因为代码过多的原因我这边会给你一个压缩包,备份好自己的子主题(被覆盖了我不负责),当然子主题没有开启或者开启了没做文件修改直接把我这个压缩包解压即可,然后固定连接重新保存下即可

访问地址是:你的域名/sites   演示地址:https://www.tucool.cn/sites 当然如果你要放到菜单上也行,想必大家都知道怎么设置菜单的自定义链接,这边我就不做多说了

B2主题网址导航- WordPress教程插图(1)

Expand

Assets

archive-sites.php

functions.php

single-sites.php

taxonomy-favorites.php

child.js 文件代码

  1. //首页搜索条
  2. var jsonData = ["百度一下","权重查询(不带http/https)","知乎","花瓣"]
  3. var jsonDataUrl = ["https://www.baidu.com/s?wd=","http://rank.chinaz.com/all/","https://www.zhihu.com/search?type=content&q=","https://www.huaban.com/search"]
  4. $('.search-tmenu li').click(function(){
  5. var _index = $(this).index();
  6. $(this).addClass("active").siblings().removeClass("active");
  7. $('.subnav').each(function(){
  8. $(this).find('div').eq(_index).addClass("active").siblings().removeClass("active");
  9. })
  10. console.log(_index)
  11. })
  12. $(".subnav-item").on("shown",function(){
  13. $("#searchForm").attr("action",jsonDataUrl[$(this).index()]);
  14. $("#searchinput").attr("placeholder",jsonData[$(this).index()]);
  15. })
  16. $(".search-item").on("click",function(){
  17. $("#searchForm").attr("action",$(this).attr("url"));
  18. $("#searchinput").attr("placeholder",$(this).html());
  19. $(this).addClass("on").siblings().removeClass("on");
  20. })
  21. $("#searc-submit").click(function(){
  22. window.open($("#searchForm").attr("action")+$("#searchinput").val())
  23. })
  24. $('#searchForm').keydown(function(e) {
  25. if (e.keyCode == 13) {
  26. window.open($("#searchForm").attr("action")+$("#searchinput").val())
  27. return false;
  28. }
  29. });

这些文件就是实现内置网址导航功能的文件缺一不可。

备份好自己的子主题 备份好自己的子主题 备份好自己的子主题  解压压缩包后 记得重新保存下固定连接

评论

11 条对“B2主题网址导航- WordPress教程”的回复

  1. pdN56K81r@sogou.com 的头像
    pdN56K81r@sogou.com

    点个赞

  2. 84BQnV84b@outlook.com 的头像
    84BQnV84b@outlook.com

    源码下载

  3. 691899807@163.com 的头像
    691899807@163.com

    楼主加油

  4. DVpeg9Jyh@vip.qq.com 的头像
    DVpeg9Jyh@vip.qq.com

    楼主加油

  5. LxEtAnvbZ@sina.com 的头像
    LxEtAnvbZ@sina.com

    老大辛苦了

  6. eUvIq660w@sina.com 的头像
    eUvIq660w@sina.com

    源码下载

  7. v5cFW11Ta@yahoo.com 的头像
    v5cFW11Ta@yahoo.com

    怎么创建自己的圈子

  8. 5WEcLw0zu@foxmail.com 的头像
    5WEcLw0zu@foxmail.com

    使用WordPress搭建的吗

  9. jNuPMtlZO@126.com 的头像
    jNuPMtlZO@126.com

    小编辛苦了

  10. Pnei9OxJF@163.com 的头像
    Pnei9OxJF@163.com

    认证需要什么

  11. 1920199138 的头像
    1920199138

    在黎明到来之前,必须要有人稍微照亮黑暗。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注