程序go 2018-05-26 09:03 采纳率: 100%
浏览 17

修改Wordpress插件?

I have a third-party WP plugin which, although no longer updated, still works fine - and for which I've not been able to find an alternative.

It's 'Zajax' - which ajax-loads internal pages... thus enabling a streaming-radio audio-player to be fixed to the viewport-base, with continuous play throughout page-changes.

However, it appears to require absolute urls - on root-relative urls it reloads the whole page (and thus stops continuous-play).

This is a hindrance, because I normally use root-relative urls - and hence sometimes forget to ensure that all internal urls are absolute rather than root-relative.

I want to modify, so that it'll work with root-relative urls - but don't know enough to do this.

  • 写回答

1条回答 默认 最新

  • weixin_33720186 2018-05-26 09:46
    关注

    Actually using root-relative URL-s is not good idea, but if it is comfortable for you, then use small jQuery snippet which may help you with the problem.

    jQuery("a").each(function(){
    if (jQuery(this).attr("href").indexOf("http")==-1){
    jQuery(this).attr("href","https://yourwebsiteurl.com/"+jQuery(this).attr("href"));
    }
    });
    

    You can put this code to footer area of your website, it will detect root-related links and convert them to normal links. (without changing anything at your backend, of course)

    评论

报告相同问题?

悬赏问题

  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本