├── headless_admin.php ├── admin.php ├── README.md └── headless.php /headless_admin.php: -------------------------------------------------------------------------------- 1 |
2 |

3 |
4 |

5 |
6 |

7 |
8 | 9 |

10 |
11 |
12 | -------------------------------------------------------------------------------- /admin.php: -------------------------------------------------------------------------------- 1 |
4 |

5 |
6 |

7 |
8 |

9 |
10 | 11 |

12 |
13 |
14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Headless Wordpress 2 | ================== 3 | 4 | Use Wordpress for its gorgeous back-end. 5 | 6 | This plugin disables everything but the Wordpress admin. It redirects most urls to the admin. All front-end related stuff is disabled (Appearance menu) and permalinks are customizably overrided. 7 | 8 | Wordpress is a great platform, but I'm tired of writing customizations in PHP. This plugin is meant to encourge front-end development in other languages. Use something like the [JSON-API Wordpress plugin](http://wordpress.org/extend/plugins/json-api/) or [django-wordpress](http://github.com/sunlightlabs/django-wordpress) as a bridge. Integrate content and data and don't worry about learning a new CMS. 9 | 10 | cd wp-content/plugins 11 | git clone http://github.com/ryanmark/wp-headless.git headless 12 | -------------------------------------------------------------------------------- /headless.php: -------------------------------------------------------------------------------- 1 | post_status != 'publish' ) $path = $post->ID; 72 | else $path = str_replace( get_option( 'siteurl' ), '', $url ); 73 | return rtrim($headless_url, ' /') . '/' . ltrim($path, ' /'); 74 | 75 | } 76 | add_filter( 'post_link', 'headless_permalink', 10, 2 ); 77 | 78 | /* 79 | * Display the admin page 80 | */ 81 | function headless_admin() { 82 | 83 | global $headless_url; 84 | 85 | if ( $_POST['headless_url'] ) { 86 | update_option( 'headless_url', $_POST['headless_url'] ); 87 | $headless_url = $_POST['headless_url']; 88 | } 89 | 90 | include('headless_admin.php'); 91 | } 92 | 93 | /* 94 | * Setup options 95 | */ 96 | function headless_install() { 97 | 98 | global $headless_url; 99 | 100 | if ( ! get_option( 'headless_url' ) ) 101 | add_option( 'headless_url', get_option( 'siteurl' ).'/' ); 102 | 103 | $headless_url = get_option( 'headless_url' ); 104 | 105 | } 106 | add_action( 'plugins_loaded', 'headless_install' ); 107 | 108 | ?> 109 | --------------------------------------------------------------------------------