admin管理员组文章数量:1291083
A while back, I had someone here help me craft a custom mu-plugin (aka: "must use" plugin) that was designed to specially handle 404 server responses. Here is that thread for context, complete with the specific code I'm referencing:
Question about repurposing WordPress 404 handler
I'm just now revisiting this project and trying to resume development on it, but am running in to some issues with using the "get_template_part" method within the mu-plugin file .. trying to pull in specific PHP template files that are part of my child theme. It doesn't seem to be working, however, and I'm wondering if either it isn't possible, -- OR -- if there might be something obvious or essential that I'm missing.
I know that I'm able to reference methods such as get_header() and get_footer() without any issues in the mu-plugin file, so I don't think I need to load the entire WP core in order to be able to use get_template_part. I've also tried to use "include" and "require" instead of "get_template_part", and that didn't work either. This leads me to suspect that I might need to set some kind of "base path" or something, though I'm not entirely sure how I might go about that.
The reason I'm eager to get this all working, by the way, is because I've already done a significant amount of custom programming within my child theme, and all of the code that I'm trying to pull in and render to the browser using the mu-plugin currently lives within that child theme. Having to duplicate all of that code within my mu-plugin file certainly wouldn't be ideal, and would likely be more difficult to maintain moving forward. So .. hopefully I can find some kind of solution to this. Please advise.
本文标签: phpUsing the gettemplatepart method within an muplugin not possible
版权声明:本文标题:php - Using the get_template_part method within an mu-plugin not possible? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741512734a2382700.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论