megumi/wp-ajaxonomy

1.1.0 2015-09-28 22:57 UTC

This package is not auto-updated.

Last update: 2024-04-27 16:47:30 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Installation

Create a composer.json in your plugin root or mu-plugins

{
    "require": {
        "megumi/wp-ajaxonomy": "*"
    }
}

Place the following code into your plugin.

require_once dirname( __FILE__ ) . '/vendor/autoload.php';

Then:

$ composer install

How to use

Megumi\WP\Ajaxonomy has same parameters with register_taxonomy().

<?php
/*
Plugin Name: My Music Library
Version: 0.1-alpha
Description: PLUGIN DESCRIPTION HERE
Author: YOUR NAME HERE
Author URI: YOUR SITE HERE
Plugin URI: PLUGIN SITE HERE
Text Domain: ajax-taxonomy
Domain Path: /languages
*/

require_once dirname( __FILE__ ) . '/vendor/autoload.php';

add_action( 'plugins_loaded', function(){
	$args = array(
		'label'            => 'Music',
	);
	$tax = new Megumi\WP\Ajaxonomy( 'music', 'post', $args );
	$tax->set_order = 'ASC';
	$tax->set_order = 'slug'; // Default is `slug`
	$tax->register();
} );

Then:

Post Screen

Taxonomy Screen