如何使用插件中的钩子过滤 WordPress 帖子?
我正在创建一个 Wordpress 插件,作为这个平台上的开发新手,我陷入了这个问题。
我希望循环中的帖子按类别过滤,由用户通过管理页面定义。我实际上希望能够修改插件中的 query_post() 参数,但我发现的唯一技巧是使用用户定义的条件重新运行 query_post() ,这是我想避免的事情。
另外,由于插件的性质,我认为修改主题的模板是没有意义的。
我确信解决方案是显而易见的,但找不到它!
I'm creating a Wordpress plugin and, being a newbie in the development on this platform, I'm stuck on this problem.
I'd like to have posts in the loop filtered by categories, defined by the user through an admin page. I would actually like to be able to modify query_post() parameters in the plugin, but the only trick I found is to re-run the query_post() with my user-defined criteria, thing that I would like to avoid.
Also, due to the plugin nature, I think it make no sense to modify the theme's template.
I'm sure the solution is evident, but can't find it!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为有一个更好的解决方案,但这就是我最终解决它的方法:
如果您有更好的解决方案的建议,请分享:)
I thought there was a nicer solution, but this is how I finally solved it:
If you tips for a better solution, please share :)