importing articles from wordpress |
[eluser]Piatra[/eluser]
i have my domain, lets call it example.com . i have wordpress in one folder and codeigniter in another. i want to import articles from wordpress to codeigniter . my structure is www.example.com/blog/ www.example.com/codeigniter/ I tried importing using Code: <?php
[eluser]CroNiX[/eluser]
I put require('blog/wp-blog-header.php'); in my index.php, then you should be able to run your query and I don't think you need to include wp-load.php. Just beware that when you include wp you will have certain functions that will be overridden. Like anchor(); will be wordpresses anchor() function because it gets defined first....and you probably don't want to use the built in anchor function because it will prefix all urls with the blog url... Its best to only include it on the page(s) that will actually use it.
[eluser]Piatra[/eluser]
Now i have another problem. when i include it it doesn't find the file. How should i do it using ../../../blog/wp-blog-header.php or the absolute path www.example.com/blog/wp-blog-header.php ? Solved the inclusion part but i still get the same error !
[eluser]CroNiX[/eluser]
If you are including it in your index.php, it is relative to that files location, which is usually in the html root dir. I assume your wp install is also in the root dir. public_html (site root) -blog (wp folder) -application (ci folder) -index.php (ci index.php) Then you would just require_once('blog/wp-blog-header.php'); in ci's index.php EDIT: include should be at the top of the index.php, before CI stuff.
[eluser]danmontgomery[/eluser]
To clarify, no matter where you include it in your CI application, the path should be relative to CI's index.php
[eluser]Piatra[/eluser]
Fatal error: Call to undefined function query_posts() in /home/example/public_html/example.com/codeigniter/application/views/external.php on line 14 im stuck at square one . i include it just fine now but it still doesn;t work
[eluser]CroNiX[/eluser]
is your Code: require_once(‘blog/wp-blog-header.php’); what if you put Code: var_dump(query_posts('showposts=5')); |
Welcome Guest, Not a member yet? Register Sign In |