Just how can CodeIgniter and Wordpress be integrated so that the feel and look/template of the Wordpress blog is transported to the CodeIgniter-produced pages?
Initial step would be to move CodeIgniter and also the Wordpress files in their own individual directory.
Next, place the following line towards the top of your CodeIgniter's index.php file. Change the road to
wordpress-blog-header.php when needed to suggest for your wordpress's root directory.
Then, you should use the next functions within your sights:
<? get_header() get_sidebar() get_footer() ?>
Other assistant functions can be found in Wordpress's documentation which could help you in integrating the look.
After I incorporated the file wordpress-blog-header.php in Codeigniter's index.php page, I acquired an issue that website_url() is determined both in codeigniter's url assistant and wordpress. I solved this while using following code.
require('blog/wordpress-blog-header.php') add_filter('site_url', 'ci_site_url', 1) function ci_site_url() header("HTTP/1. 200 OK")
Last line must be added as wordpress file was adding a http response header 'HTTP/1. 404 Page not found' towards the header.
Now its fine to make use of wordpress functions to get in touch with Codeigntier.
if you are thinking about while using code ignitor site_url function inside your code, or maybe you are carrying out a merge of the existing CI site and Wordpress... this can be useful:
towards the top of CI index.php:
require_once '../wordpress-blog-header.php' add_filter('site_url', 'ci_site_url', 4) function ci_site_url($url, $path, $orig_plan, $blog_id) amplifier get_instance() $new_path = str_replace("YOURSITEURLGOESHERE", "", $url) return $CI->config->site_url($new_path)
effectively this enables you to employ site_url in CI, so if you have added a lot of links and content for your project it could assist you.