=== Cursorial === * Contributors: spurge, redundans, alfreddatakillen * Tags: cursorial, content, post, custom, editing, loops * Requires at least: 3.2.1 * Tested up to: 3.3.1 * Stable tag: 1.1 * License: GPLv2 Create custom loops and edit it's posts with an easy drag-and-drop interface. Override the post's title, content, excerpt and images. Then display the loops' posts with a widget or a theme template file. == Description == With this plugin you can create your own [loops](http://codex.wordpress.org/The_Loop "The Loop « Wordpress Codex") and manage them with a simple drag-and-drop interface. Register one or more loops in your theme's `function.php` and then use them as any other loop in your theme with `have_posts()`, `the_post()` etc. Editors can then manage these loops in the administration by simply drag posts to these loops or between them and override the posts' content if they like. They'll find posts in a search box just next to the loops. **The loops can be configured to ...** * allow just a limited number of posts, * allow just a specified set of post types, * to have posts with children (like nested loops, related content etc), * make posts' content overrideable and optional, * be set together in the administration, * and use images fetched from content or the featured image. **This plugin also comes with a widget that ...** * displays a registered loop * or creates one for you. = No additional database tables or writeable directories are added = This plugin will simply register a hidden [custom post type](http://codex.wordpress.org/Post_Types "Post Types « Wordpress Codex") and a [custom taxonomy](http://codex.wordpress.org/Taxonomies "Taxonomies « Wordpress Codex"). It's therefore installable/runnable on most kinds of web hosts/environments. = More info, wiki and issue tracker = https://github.com/klandestino/cursorial == Installation == = 1. Install the plugin = You can install Cursorial using the built in Wordpress plugin installer. If you wish to install Cursorial manually, make sure you've uploaded the plugin to `wp-content/plugins/cursorial`. Activate the plugin in the _Plugins_ admin panel using the _Activate_ link. You'll then be able to register your loops and use the widget that follows with this plugin. = 2. How to use the widget = Drag the _Cursorial Widget_ to any preferable sidebar in _Widget_ admin panel found in _Appearence_. You'll then see a list of available loops, called blocks, if you've registered any. If not, you'll be able to create one for the current widget by checking the _Custom block_ radio button. You can set the maximum number of posts and what fields that will be available. All widget-created blocks are then found in the _Custom Widget Blocks_ admin panel found in the _Cursorial_ menu. = 3. Register your loops in the theme's function.php = Use `register_cursorial()` to register loops. This function takes two arguments. First an array with the loops you want, and then another array with information about how your loops will be shown for the editors in the administration. Here's some lines of code: add_action( 'after_setup_theme', 'your_theme_setup' ); function your_theme_setup() { if ( function_exists( 'register_cursorial' ) ) { register_cursorial( array( // Array with the custom loops 'main-feed' => array( // The key is the name of the loop 'label' => __( 'Main Feed' ), // The official label of the loop 'max' => 2, // The maximum amount of allowed posts 'post_type' => array( 'page' ), // Limit posts with post type. Can be defined as an array or a string 'childs' => array( // If set, all posts in this loop can have childs 'max' => 2, // The maximum amount of allowed childs posts 'post_type' => 'post', // Limit child posts with post type 'fields' => array( // Set the displayable child post field 'post_title' => array( // The key is the name of the post field 'optional' => false, // If set to true, the field can be hidden by the editor in the admin 'overridable' => true // If set to true, the field's content can be overridden by the editor in the admin ), 'post_date' => array( 'optional' => true, 'overridable' => false ) ) ), 'fields' => array( // Set the displayable post field 'post_title' => array( 'optional' => false, 'overridable' => true ), 'post_excerpt' => array( 'optional' => false, 'overridable' => true ), 'image' => array( // This field will fetch the first occuring image from the post 'optional' => true, 'overridable' => true ) ) ), 'second-feed' => array( 'label' => __( 'Secondary Feed' ), 'max' => 4, 'fields' => array( 'post_title' => array( 'optional' => false, 'overridable' => false ), 'post_excerpt' => array( 'optional' => true, 'overridable' => true ), 'post_date' => array( 'optional' => false, 'overridable' => false ) ) ) ), array( // Second argument is an array with some admin config __( 'Home' ) => array( // The key is the name of the page where editors can edit specified loops 'main-feed' => array( // The key is the name of the loop that will be editable 'x' => 0, // In what column this loop should be placed 'y' => 0, // In that row this loop should be placed 'width' => 2, // How many columns this loop is wide 'height' => 7 // How many rows this loop is tall ), 'banner-space-1' => array( // If there's no matched loop with this name, the space will be occupied by a dummy placeholder 'x' => 2, 'y' => 0, 'width' => 1, 'height' => 2, 'dummy-title' => __( 'Banners' ), // A customized title 'dummy-description' => __( 'On front page there are a couple of banners here.' ) // A customized description ), 'second-feed' => array( 'x' => 2, 'y' => 2, 'width' => 1, 'height' => 3 ) ), __( 'Sub pages' ) => array( // Another admin page with a set of loops '_dummy' => array( 'x' => 0, 'y' => 0, 'width' => 2, 'height' => 7, 'dummy-title' => __( 'Page or post content' ), 'dummy-description' => __( 'The current page or post content.' ) ), 'second-feed' => array( 'x' => 2, 'y' => 0, 'width' => 1, 'height' => 7 ) ) ) ); } } = 4. Query the posts = There are two ways to print the posts from your customized loops. You can embed a loop anywhere in your theme with `query_cursorial_posts()`. This will work almost exactly as if you used `query_posts()` (see [reference](http://codex.wordpress.org/Function_Reference/query_posts "Function Reference/query posts « Wordpress Codex")). The only difference is that you'll not be able to customize the loop with arguments. `query_cursorial_posts()` takes only one argument, and that's the name of the loop that you want to get posts from. If you omit this argument, the function will query posts from the first occuring registered loop. Example: