Memasukan Script Wordpress Ke Codeigniter

Step 1:

Download the Wordpress framework from wordpress.org

Step 2:

Copy the Wordpress folder and paste into the Codeigniter root folder

Step 3:

Modify the "index.php" of Codeigniter and add Wp function to Codeigniter

Search this code "require_once BASEPATH.'core/CodeIgniter.php';"

Then, Add the below code above this code.

"require_once('[WORDPRESS FOLDER NAME]/wp-blog-header.php');"

WORDPRESS FOLDER NAME = Name of the Wordpress root Folder eg: blog

Step 4:

Create Datebase

Install Wordpress by run url "localhost/[CODEIGNITER FOLDER NAME]/[WORDPRESS FOLDER NAME]"

CODEIGNITER FOLDER NAME = Name of the Codeigniter root Folder

Step 5:

Blog Post Fetch Query for codeigniter home page

<?php

$BlogPosts = new WP_Query('showposts=3');

if($BlogPosts->have_posts()):

while($BlogPosts->have_posts()) : $BlogPosts->the_post();

the_title();

the_content();

endwhile;

endif;

?>

showposts = Number of the posts you have to show in that page (Home Page).

If you Have any Doubts!

Contact Me through Facebook

www.facebook.com/PradeepOfficial/

or Youtube Comments

Comment below this Youtube Video. Hope soon I will Reply you.


Comments