CodeIgniter Forums
site_url function collision with Wordpress - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: site_url function collision with Wordpress (/showthread.php?tid=68491)



site_url function collision with Wordpress - koeninger - 07-18-2017

Hi,
I've used CI for many years now for my application and have Wordpress running on the same site for a blog. Problem has always been that both Wordpress and CI use the same function site_url(). It would be great if this could be resolved in version 4.

Many thanks, Alan


RE: site_url function collision with Wordpress - skunkbad - 07-19-2017

(07-18-2017, 07:50 PM)koeninger Wrote: Hi,
I've used CI for many years now for my application and have Wordpress running on the same site for a blog. Problem has always been that both Wordpress and CI use the same function site_url(). It would be great if this could be resolved in version 4.

Many thanks, Alan

This should never be a problem, and if it is you are attempting to run both applications in a single request. I'm guessing this is very uncommon, as there are better ways to run both CI and WordPress simultaneously without loading them both. What exactly are you doing?


RE: site_url function collision with Wordpress - koeninger - 07-19-2017

Hi,
I am using CI to handle the page templating, but using Wordpress to make the content editable (via the CMS). Otherwise I have to have two sets of headers, footers etc. I only load Wordpress for one section on the site and want to avoid duplication.


RE: site_url function collision with Wordpress - skunkbad - 07-19-2017

(07-19-2017, 12:35 AM)koeninger Wrote: Hi,
I am using CI to handle the page templating, but using Wordpress to make the content editable (via the CMS). Otherwise I have to have two sets of headers, footers etc. I only load Wordpress for one section on the site and want to avoid duplication.

If WordPress is never actually displaying the content, and instead you are displaying all content with CodeIgniter, the best solution is to use a subdomain for WordPress, like content.example.com. This lets you use the CMS you desire, and then you just create a custom model(s) for CI so it can go get the content and display it. I've done this a few times. Just share a database between the two apps.