CodeIgniter + Wordpress Integration

My site is developed using Wordpress. Some theme pages have a custom PHP script for booking things that I want to reorganize into CodeIgniter in order to get more flexibility. Questions:

1) how to use CI functions in WP with CI routing system? Should I create a CI page index.php / controller / page1 / and then call it in Wordpress?

2) Do I need to use the "ViewSys" CodeIgniter system or the "Wordpress theme pages" to get my result?

thanks

+6
source share
2 answers

I used the following.

My goal is to use CodeIgniter for some pages and leave the rest of the pages in Wordpress intact. I have only a few steps for this:

Copy the CI folder in the root directory of Wordpress

Modify the "index.php" CI to add include, which will add WP functions to CodeIgniter:

@require '../wp-load.php'; require_once BASEPATH.'core/CodeIgniter.php'; 

After adding this line, Wordpress functions will be used in CodeIgniter; they will be used primarily for viewing.

Modify .htaccess WP to not rewrite CI URLs: After this line:

  RewriteRule ^index\.php$ - [L] 

Add this line:

 RewriteCond %{REQUEST_URI} !^/(codeigniter_folder|codeigniter_folder/.*)$ 

CI views can then use WP features.

+9
source

If you have a CI application that uses a login session, you need to modify the file "load.php" (from the "wp-includes" WP folder). To do this, follow PhilB's answer from this link . For a full explanation, follow this post .

+2
source

Source: https://habr.com/ru/post/950160/


All Articles