Title: WordPress API?
Last modified: August 18, 2016

---

# WordPress API?

 *  [Deane](https://wordpress.org/support/users/deane/)
 * (@deane)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/)
 * How easy is it to abandon WordPress templates completely?
 * I have a site into which I want to integrate WordPress, but it would need to 
   live in and around amongst much other code. WordPress would power small pieces
   on certain pages, but it would never be the sole focal point of an entire page.
 * I’ve done a little work with this in a plugin:
 * `
    $lastFivePosts = get_posts(''); foreach ($lastFivePosts as $post) { //Stuff
   here }
 * But the whole plugin thing would get a little unwieldly. Is there an existing
   PHP API (not the plugin API) that would let you access WordPress posts and such
   from outside the system? Obviously, the code above works solely because its runs
   in the context of WordPress, with all the include files and such that it entails.
 * I know I could do raw SQL — and I will without other options — but I was hoping
   someone else had done something similar.
 * Deane

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [vkaryl](https://wordpress.org/support/users/vkaryl/)
 * (@vkaryl)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/#post-205493)
 * Check the [Codex](http://codex.wordpress.org/The_Loop) for info about The_Loop
   on non-WP pages….
 *  [xerocool](https://wordpress.org/support/users/xerocool/)
 * (@xerocool)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/#post-205494)
 * [http://www.google.com/search?hl=en&lr=&q=Wordpress+API+codex&btnG=Search](http://www.google.com/search?hl=en&lr=&q=Wordpress+API+codex&btnG=Search)?
 *  [Denis de Bernardy](https://wordpress.org/support/users/denis-de-bernardy/)
 * (@denis-de-bernardy)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/#post-205496)
 * Funny, I’m taking the opposite approach. WordPress’ plugin API is not perfect
   but it makes it the most powerful CMS platform I’ve tried so far. If I were you
   I’d give it another shot.
 * First off, grab the following for inspiration:
 * [http://www.semiologic.com/projects/sem-theme/](http://www.semiologic.com/projects/sem-theme/)
 * Then, get a plugin like php exec:
 * [http://priyadi.net/archives/2005/03/02/wordpress-php-exec-plugin/](http://priyadi.net/archives/2005/03/02/wordpress-php-exec-plugin/)
 * And that’s it. You get:
 * – A fully functional CMS that lets you easily create and manage any number of
   pages, with any number of page templates
    – A way to insert custom code (e.g.
   a forum, an image gallery) and features anywhere you want in your pages
 *  [Denis de Bernardy](https://wordpress.org/support/users/denis-de-bernardy/)
 * (@denis-de-bernardy)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/#post-205498)
 * Also, you might want to check the doc for $wpdb, to fetch custom code listings.
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/#post-205508)
 * wordpress templates give you default navigation and content display. if you want
   to do something differently, you certainly can. I think the key starting file
   to look at is wp-blog-header.php, as that really starts off all processing, etc.
   You can also direct-include wp-config to start things off, though you now have
   to manually call a few more things (that imho should have been in config but 
   are in blog-header).
 * really depends on what/how you are looking to integrate, and what the ‘rest of
   the site’ is that isn’t using WP stuff… i.e., why WP at all?
 * -d

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WordPress API?’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 5 participants
 * Last reply from: [davidchait](https://wordpress.org/support/users/davidchait/)
 * Last activity: [21 years, 1 month ago](https://wordpress.org/support/topic/wordpress-api/#post-205508)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
