I have tried to integrate codeigniter and wordpress in my system and it does. By putting the wordpress in my codeigniter root seems to be working but adjustments has been made in the config, index and route.php. I can use wp functions now in my codeigniter view file, however, there is a problem occur. Whenever I access other functions in my controller, it redirects to the index function of the controller. What is the problem with this? Is there a conflict between wp and ci url with this or there could be other reason? If there is, how could I solve this one? Here are my codes. Thanks for the help.
Config.php
from:
to
routes.php
<strong>the default routing works fine</strong>
from:
<strong>any of the options below results to the problem indicated above</strong>
to: 3 routing options
option 1:
option 2:
option 3:
controller: ci_pages.php
Config.php
from:
Code:
$config['index_page'] = 'index.php';
Code:
$config['index_page'] = '';
routes.php
<strong>the default routing works fine</strong>
from:
Code:
$route['default_controller'] = "welcome";
Code:
$route['404_override'] = '';
<strong>any of the options below results to the problem indicated above</strong>
to: 3 routing options
option 1:
Code:
# Option 1 - Use this section for a normal CI site
# with WP in its own folder
$route['default_controller'] = "ci_pages";
$route['(:any)'] = "wp_pages/$1";
$route['(:any)'] = "ci_pages/$1";
$route['404_override'] = '';
option 2:
Code:
# Option 2 - Use this section for a blended CI/WP site
# with selected WP pages routed to eppear in the web root
# Any WP route outside the WP folder must be set up as a CI route.
$route['default_controller'] = "ci_pages";
$route['(:any)'] = "ci_pages/$1";
$route['sample-page'] = "wp_pages/$1";
$route['404_override'] = '';
option 3:
Code:
# Option 3 - Use this section for a CI site where WP is only
# for content management and does not display its own pages
# through CI routing.
$route['default_controller'] = "ci_pages";
$route['(:any)'] = "ci_pages/$1";
$route['404_override'] = '';
controller: ci_pages.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class CI_Pages extends CI_Controller
{
public function index()
{
$this->load->view('home');
}
public function test()
{
$this->load->view('test');
}
}
?>