You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改Redux生成的theme.js或让jQuery生效以调整WordPress布局?

求调整WordPress商业主题布局的可行方案

我购买的WordPress商业主题,前端页面由Redux WP插件生成的压缩版复杂JavaScript文件theme.js渲染。由于主题支持许可证过期,官方拒绝提供技术支持,而且已经有10位现代JS自由职业者放弃了这个任务。我的需求是移动几个div内容块来优化页面布局,目前有两个解决思路:

  • 思路1:直接修改theme.js中的对应代码——我已经明确标出需要调整的三个React.createElement代码块(产品ID块、添加到对比块、点赞浏览分享打印组件块)及其目标位置;
  • 思路2:让我自己编写的jquery-mod.js代码在theme.js之后生效,该代码目前仅在打开浏览器开发者工具时能正常运行。

我尝试过React、Node.js、Webpack等框架的多种jQuery集成方案(如import jQuery、nodeQuery、expose-loader等),但均未成功,现寻求可行的解决方案。

以下是jquery-mod.js的代码:

jQuery(function() {
    jQuery('section.product--section:nth-child(1)').insertBefore('.profile--owner');
    jQuery('.product--actions.flex.justify-between.py-14.pl-24.pr-30.bg-grey-100').insertBefore('.product--advertisement.mt-30');
    jQuery('.product--section.product--section__actions.flex.flex-wrap.justify-between.mb-20').insertBefore('.product--advertisement.mt-30');
});

内容的提问来源于stack exchange,提问作者Nikola Nick Pantic

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 08:42:52