# Routes Simple routing for WordPress. Designed for usage with [Timber](https://github.com/timber/timber) [![Build Status](https://img.shields.io/travis/Upstatement/routes/master.svg?style=flat-square)](https://travis-ci.org/Upstatement/routes) [![Coverage Status](https://img.shields.io/coveralls/Upstatement/routes.svg?style=flat-square)](https://coveralls.io/r/Upstatement/routes?branch=master) [![Packagist Downloads](https://img.shields.io/packagist/dt/Upstatement/routes.svg?style=flat-square)]() ### Basic Usage ```php /* functions.php */ Routes::map('myfoo/bar', 'my_callback_function'); Routes::map('my-events/:event', function($params) { $event_slug = $params['event']; $event = new ECP_Event($event_slug); $query = new WPQuery(); //if you want to send a custom query to the page's main loop Routes::load('single.php', array('event' => $event), $query, 200); }); ``` Using routes makes it easy for you to implement custom pagination — and anything else you might imagine in your wildest dreams of URLs and parameters. OMG so easy! ## Some examples In your functions.php file, this can be called anywhere (don't hook it to init or another action or it might be called too late) ```php 'foo', 'bar' => 'I dont even know'); Routes::load('archive.php', $params, $query); }); ``` ## map `Routes::map($pattern, $callback)` ### Usage A `functions.php` where I want to display custom paginated content: ```php