We have a Wordpress website currently working and want to migrate to Laravel 5. For some reasons we want the website to be moved part-by-part. Every newly redesigned page will be implemented by Laravel and old pages still remain on Wordpress.
I want if there is a route registered for current URL in Laravel, then load it from Laravel, else let Wordpress to load it.
We don't want to have any /wordpress/ in URL. Also the administrations panel should still be accessed using /wp-admin url without any prefix.
Is there any clear solution for this?
Actually the solution exists. Recently, I managed to migrate my Wordpress site to Laravel "gradually". At first, I "combine" Laravel to use WP database using Corcel package. And the routes were still handled by WP, which Laravel just catch the full URL request and passed it to controller like this:
Route::get('/{ids}', 'UrlController#withIds')->where('ids', '^(?!admin).*');
where the {ids} was just passed to WP's get_page_by_path($id); function and returned the data to the blade template.
Related
I have a wordpress site, it works with nginx, I am moving the front end to laravel but still using the wordpress admin. I am making this change little by little and at this moment I would only want the home to load laravel and the rest remains Wordpress, is this possible? is there any way?
I'm trying to add pages made in laravel to the wordpress site
I have a multilingual laravel application. My url structure like that:
https://example.com/en/paths
https://example.com/es/paths
I installed wordpress in /public/blog. It is working successfully.
I also installed WPML plugin in wordpress then url structure was like this,
https://example.com/blog/en/blog-paths
https://example.com/blog/es/blog-paths
So my first URL structure is broken. This is a situation I would not prefer for SEO.
Any advice on how to install wordpress inside Laravel application, keeping the multilingual url structure?
I want to result url structure like this instead of above schemes,
https://example.com/en/blog/blog-paths
https://example.com/es/blog/blog-paths
I'd try to install Wordpress inside public folder of your Laravel app that is in charge of responding to example.com via app/public/index.php
Thus, every request to app/public/blog/ will be handled by WordPress.
Imho, this setup save your current url structure and do not interfere in any way.
Probably you have to adjust your Nginx config, but that is another question.
I understand this sort of breaks the structured point of Laravel, but there is method to my madness. I plan on using a single install of laravel to host several websites that are database driven. At the moment all of the sites share the same layout and I have a system to store some custom CSS in the DB to give each site a different color scheme. I want to change this so they can use completely different views. So site A loads views/theme1/app.blade.php and site B loads views/theme2/app.blade.php.
I have implemented this by using the following to return a view.
$theme = getDomainThemeName();
return view($theme.'/home');
This is also working, but i am now left with the task of dynamically loading the assets. I am using bootstrap the generate the themes and making a few tweaks to the HTML to create the app.blade.php file. I have 2 potential solutions to this but i would much rather a way to server the css files from the views directory. This means the following mapping.
http://website.com/css/style.css =>
/resources/views/theme1/css/style.css
Can something like this be done? Another option would be to use php to read the css file and insert it into the app using a yield. It works, but it means i cant use browser caching to cache the assets. I was also thinking i could just create sub directories in the public folder. public/theme1/css/style.css. This makes the most logical sense, but it means i have to fragment the theme system. Id like to be able to unzip a theme in the views directory and it just works.
I am using Laravel 5, i have root access to the server too. Running PHP 5.4 on centos 7.
I think the best approach is having next structure:
/public/css/style.css
/public/css/theme1/custom1.css
/resources/views/common.blade.php
/resources/views/theme1/main.blade.php
And then loading conditionally with php each site theme.
It may not be any trouble with caching.
I have a project built in Symfony2. I'm using FOSUserBundle to manage users. Now I have to integrate Wordpress into my project. Wordpress has to be available in subfolder: http://example.com/blog. I already managed to achieve such state, everything works like a charm, but now I need to share session between Symfony2 project and Wordpress. Actually I don't really know if session share is right solution to my problem. The thing is that I want to the same design in Wordpress as I use in Symfony project. In my Symfony project I have a top bar which indicates that user is authenticated. If user will authenticate via Symfony (I want it to be the only possible way) I want him to see that he is authenticated also while browsing the Wordpress blog. So session share was my first thought, but maybe there are other, more effective solutions? Maybe loading this top bar into iframe in Wordpress? Can EkinoWordpressBundle solve my problem?
If the WordPress installation is on the same domain in a folder, the session should be available trough PHP. You can check it by using the $_SESSION variable from PHP and add some code to your header.php to show the authentication details .
Is there any way to access WordPress functions in CodeIgnighter? Basically I am running a website entirely using WordPress but I need to build a custom add-on system that needs to be separate from WordPress (so not a plugin). Thanks to this link
I can get WP functions working in views but not in controllers or models.
My folder structure is WordPress installed in site root then the CodeIgnighter in WordPress: root/wordpress/codeignighter
I need this as I want to use WordPress user functions so people can use the CI system with their WP accounts.
Turns out this was an error on my behalf I forgot to declare some global variables as the linked solution clearly states. My bad