admin管理员组文章数量:1332339
We are building a hybrid mobile app for a website.
The app will display a minimal version of the webpage, for example if the website displays post title, post content, sidebar, widgets, etc, then the app would show just post title and the post content for the same post.
Take for example the single post page which is typically rendered by single.php
.
For a URL www.example/sample-post
, the mobile app will visit a custom HTML endpoint www.example/minimal/sample-post
which will be rendered by minimal-single.php
The problem is that the WordPress loop doesn't work inside minimal-single.php
because the query variables and the query that is set up for single.php
is not set for this endpoint /minimal/sample-post
(mimnimal-single.php
).
You might say I could use a custom WP_Query
to loop through the posts but at the moment there are few restrictions which doesn't allow us to do this.
Is there a way in which we can instruct WordPress to initialise the same globals, query vars and the query used by an endpoint for some other endpoint?
I want to extend this to WooCommerce where the web version can use /product/sunglasses
and the app can use /minimal/product/sunglasses
and use the WooCommerce loop directly without using WP_Query
.
本文标签: rewrite rulesWordPressreplicate same globalsquery vars and query for an alternate endpoint
版权声明:本文标题:rewrite rules - WordPress - replicate same globals, query vars and query for an alternate endpoint 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742331546a2454795.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论