icreation Posted November 6, 2015 Share Posted November 6, 2015 According to this page http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website it should be easy to bring Wordpress posts onto a page. However, using this method in PW it is giving me an Internal Server Error. Any idea how this could be done, the databases are in the same location. Link to comment Share on other sites More sharing options...
horst Posted November 6, 2015 Share Posted November 6, 2015 Haha, funny sentence, >> "it should be easy" << But seriously, how have you setup this? Are both programms running on the same server and within the same domain? Or are they separated by subdomains? But regardless, I would create a script within the WordPr*ss site / directory, according to the guidance you have linked too, but would create and output JSON data. The URL of that script, I would read in from PW and create the posts. $url = "http://wrdprss.domain.tld/path/to/jsonexport.php"; $opts = array( 'http' => array( 'method' => "GET", 'header' => "Accept: application/json\r\n" ) ); $context = stream_context_create($opts); $jsondata = file_get_contents($url, false, $context); if (preg_match("#HTTP/[0-9\.]+\s+([0-9]+)#", $http_response_header[0], $matches) && 200 == intval($matches[1])) { // now parse the data and build the html ... } Link to comment Share on other sites More sharing options...
MuchDev Posted November 6, 2015 Share Posted November 6, 2015 Well the first thing that you will want to do is go into your /site/config.php and set $config->debug = true; Then you should get a bit more of a verbose error message. Internal server error could be for anything. Link to comment Share on other sites More sharing options...
adrian Posted November 6, 2015 Share Posted November 6, 2015 Is the WP site still being updated? If you are closing it down and would prefer to move all the posts into PW, we have an importer: https://github.com/NicoKnoll/MigratorWordpress If not, you might try using the RSS feed from the WP site and use this module to render it: http://modules.processwire.com/modules/rss-feed-loader/ - not sure about this - just a quick idea Link to comment Share on other sites More sharing options...
icreation Posted November 6, 2015 Author Share Posted November 6, 2015 Thanks for the replies. They are on the same domain with all the tables on the same database. The JSON method is sound, however I was trying to use the existing ability that WP has for embedding in other environments. However, a little bit of thought has come up with a method. It is not ideal that we are modifying the core files on both application so I would welcome an improvement to this method. Here is how to get a working Processwire website working with a Wordpress Blog. The blog posts can be displayed on the front page. The PW navigation bar will display dynamically on the WP pages. 1. In Wordpress add this to the /wp-content/themes/.../functions.php if (strpos($url,'/blog/') !== false) { include("/path/to/processwire/index.php"); } $global = wire('pages')->get(1); 2. In Wordpress add this to the top of /wp-content/themes/.../header.php global $global; 3. In Processwire wire/core/LanguageFunctions.php and also in Wordpress /wp-includes/l10n.php Wrap these 3 functions with if statements to stops them being declared again. if (!function_exists('__')) { ... } if (!function_exists('_x')) { ... } if (!function_exists('_n')) { ... } 4. One error that seems to occur is that any instances of $pages->get(...); needs to be replaced by wire('pages')->get(...); as detailed in PW documentation. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now