When you add a table name do it without the prefix. It will be prefixed for you. This is only good for custom queries on tables you created or just custom queries that you can't find a WordPress function that will do it for you.
will get all rows.
Ath_DB::table( 'events' )->get();
will get all rows that matches this ID
Ath_DB::table( 'events' )->where( 'post_id', '=', 420 )->get();
You can specify order as well
Ath_DB::table( 'events' )->where( 'post_id', '=', 420 )->order_by( 'id', 'DESC' )->get();
You can also nest where clauses
Ath_DB::table( 'events' )->where( 'id', '=', 81 )->or_where( 'id', '=', 82 )->get();
Ath_DB::table( 'events' )->insert( [title => "pizza tasting", location => "NYC"] );
You can insert multiple arrays in this form:
Ath_DB::table( 'events' )->insert( [
[title => "pizza tasting", location => "NYC"],
[title => "burger tasting", location => "Chicago"]
] );
Will delete where ID is 25
Ath_DB::table( 'events' )->where( 'id', '=', 25 )->delete();
Will delete all events!
Ath_DB::table( 'events' )->delete();
You can create cateogry like(hierarchical) or tag like taxonomies.
function ath_register_company_taxonomies()
{
$ath_taxonomy = new Ath_Taxonomy();
//params - ($post_type, $taxonomy_key, $name, $singular_name, $slug).
$ath_taxonomy->create_hierarchical_taxonomy( "company", "company_category", "Company Categories", "Company Category", "company-category" );
$ath_taxonomy->create_hierarchical_taxonomy( "company", "company_stage", "Company Stages", "Company Stage", "company-stage" );
$ath_taxonomy->create_taxonomy( "company", "company_tag", "Company Tags", "Company Tag", "company-tags" );
}
add_action( 'init', 'ath_register_company_taxonomies' );
function a_theme_register_event()
{
$ath_post_type = new Ath_Post_Type();
//params - ($post_type, $plural_name, $singular_name, $slug, $capability_type, $supports = array(), $public = true).
$ath_post_type->ath_register_post_type( 'event', 'Events', 'Event', 'event', 'post', array( 'title', 'thumbnail' ) );
}
add_action( 'init', 'a_theme_register_event' );