Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Aubreypwd/itempress

ItemPress Codex

I am currently in the process of improving this Codex.

Getting Involved & ItemPress-develop

Contributing to ItemPress code is easy, just head over to the ItemPress-develop repo on BitBucket at https://bitbucket.org/aubreypwd/itempress-develop and start hacking.

ItemPress's SVN repo is synced periodically to ItemPress-develop for beta purposes. ItemPress-develop is seen as non-beta, non-production code.

Tools in /tools

ItemPress-develop comes with a set of tools in the /tools directory of ItemPress-develop to help make development easier.

Committer Tools

/tools/clean-svn.sh

Use sh /tools/clean-svn.sh svn-dir/trunk or sh /tools/clean-svn.sh svn-dir/tags/[tag] to clean out unnecessary files for the WordPress SVN repo before committing.

ItemPress API

ItemPress is designed, like WordPress, to be extendable using the ItemPress API.

Hooks

Hooks in WordPress allow you to modify and interact with certain components. Below is a list of hooks that ItemPress provides.

Adding new Taxonomies

Hook: itempress_add_tax

Too add new taxonomy groups to ItemPress, you can use the itempress_add_tax hook. You can read more by visiting Adding New Taxonomy Groups

How to use use itempress_add_tax

ItemPress supports Labels and Associations out-of-the-box, but supports the ability to add additional taxonomies. This can easily be done as a plugin.

The following example shows how to add a "Status" taxonomy to ItemPress using the itempress_add_tax_status hook.

<?php
/**
 * Plugin Name: ItemPress Status Labels
 * Plugin URI: https://bitbucket.org/aubreypwd/itempress-status
 * Description: Adds status labels to items
 * Version: 0.1
 * Author: Aubrey Portwood
 * Author URI: http://aubreypwd.com
 * License: GPL2
 * Tags: projects, project, management, notes, remembering, tasks, bugs, issue, tracker
 */

/*  Copyright 2013  Aubrey Portwood  (email : aubreypwd@gmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

add_action('itempress_add_tax','itempress_add_tax_status');

function itempress_add_tax_status(){

    global $itempress_tax;

    $itempress_tax->add_tax(array(
        'taxonomy'=>'item_status',
        'args'=>array(
            'label' =>'Statuses',
            'rewrite' =>array(
                'slug' => 'item-status'
            ),
            'capabilities' =>array(
                'assign_terms' => 'edit_posts',
                'edit_terms' => 'edit_posts'
            ),
            'show_in_nav_menus'=>true,
            'hierarchical'=>true,
            'show_admin_column'=>true,
            'labels'=> array(
                'name'              => 'Statuses',
                'singular_name'     => 'Status',
                'search_items'      => 'Search Statuses',
                'all_items'         => 'All Statuses',
                'parent_item'       => 'Parent Statuses',
                'parent_item_colon' => 'Parent Status:',
                'edit_item'         => 'Edit Status',
                'update_item'       => 'Update Status',
                'add_new_item'      => 'Add New Status',
                'new_item_name'     => 'New Status',
                'menu_name'         => 'Statuses',
                'meta_name'         => 'Status'
            )
        )
    ));
}

?>