-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Any option to output wordpress into a Razor page ? #133
Comments
Great question :) We're looking into something like this. It is probably possible! It would need to break the WordPress request lifecycle into smaller parts, but essentially that's exactly what's happening inside WordPress themes - it renders pieces of the pages wherever it needs to. The simplest way is the other way around;
In this way, WordPress would be in the correct state when we need to be. The more complicated/correct way would be to implement something around WordPress that would simulate the request lifecycle on-demand ... (just guessing ..) |
Thank you for the fast answer :-) What you describe would be the best possible option (to e.g. $wp_query->have_posts() directly in Razor, so more or less a theme in aspnetcore with option to e.g. use wordpress widgets/partials in razor) but I think this will be pretty complex to get into :-D A easier way what would already suits my needs would be if I just use a "stripped" theme (in php, just without get_header etc.) and use this page as it comes from Wordpress (but embedded in Razor to have consistent layout and other middleware in place). Do you see any option to have something like this with the current featureset ? Just to explain why: I use e.g. signalr and blazor on the frontend, if I would do it the way around (wordpress renders/include Razor page) this will break multiple options that I want to have handled by razor. If wordpress would be able to get rendered into razor this will be also extremely helpful for e.g. community parts (buddypress), calenders or payment processing (woocommerce). |
yes, that's an awesome feature. I'm afraid it's out of my scope :) |
Hi, I've added a simple implementation for this idea :-) Seems to work for my use case - If you want please have a look, I've created a PR for it |
I want to ask if there is any option to render Wordpress in razor as "@RenderBody()". This would be pretty helpful and a great usecase for peachpie to create e.g. the blog pages in WP but preserve the layout for everything else (or mix up functionality)
I include Wordpress with specified HomeUrl/SiteUrl directly in my aspnetcore application and use SQLite as database, this works fine but I need the option to "render" wordpress directly into a Razor Page (with the default _Layout.cshtml).
I checked your sample code to integrate php into a razor view (https://github.com/iolevel/peachpie-samples/tree/master/mvc/render-php-within-razor) but the wordpress routes seems to get rewritten though the middleware so I'm unsure if this could work that way.
Thank you for the awesome work :-)
The text was updated successfully, but these errors were encountered: