Wordpress Post Integration with Cakephp3

I am working on cakephp 3.x and want to display the blog section on my site. I want to use the WordPress feature on my site.

I installed WordPress 4 on my local server, then imported the WordPress tables into the cake database and put the WordPress folder in the webroot Cakephp folder.

In the initialization function () of the application controller, I put this code as follows:

global $wpdb; define('WP_USE_THEMES', false); require($_SERVER['DOCUMENT_ROOT']."/webroot/blog/wp-config.php"); 

So that I can embed WordPress in cakephp (it seems this is not useful).

I tried this tutorial but did not succeed on this Tutorial Link .

I know that in this tutorial the Wordpress folder is placed from the webroot folder, and I tried it too.

When I launch the site using http: example.com/blog

He asks the blog administrator, and I understand that this is due to the fact that there is no blog controller in the src / controller block.

I tried using the .htaccess code as suggested in the tutorial, but did not succeed. Can someone help me solve this problem? Please let me know the necessary steps for integration.

+6
source share
1 answer

You can use the "API"

 <?php require('/the/path/to/your/wp-blog-header.php'); $posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($posts as $post) : setup_postdata( $post ); ?> <?php the_date(); echo "<br />"; ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endforeach; ?> 

Source: http://codex.wordpress.org/Integrating_WordPress_with_Your_Website

Or try the WP API;)

+2
source

All Articles