Example #1
0
function hocwp_shop_product_meta_boxes($post_type, $post)
{
    if ('product' == $post_type) {
        $meta = new HOCWP_Meta('post');
        $meta->set_title(__('Product Information', 'hocwp-theme'));
        $meta->set_id('hocwp_product_information');
        $meta->add_post_type('product');
        $args = array('id' => 'sku', 'label' => __('SKU:', 'hocwp-theme'));
        $meta->add_field($args);
        $args = array('id' => 'regular_price', 'label' => __('Regular price:', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_number');
        $meta->add_field($args);
        $args = array('id' => 'sale_price', 'label' => __('Sale price:', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_number');
        $meta->add_field($args);
        $args = array('id' => 'out_of_stock', 'label' => __('Out of stock?', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox');
        $meta->add_field($args);
        $meta->init();
        $args = array('post_type' => 'product', 'field_id' => 'short_description', 'title' => __('Short Description', 'hocwp-theme'));
        hocwp_meta_box_editor($args);
        $args = array('post_type' => 'product', 'field_id' => 'gallery', 'title' => __('Gallery', 'hocwp-theme'));
        hocwp_meta_box_editor_gallery($args);
    }
}
    hocwp_register_post_type_news();
}
add_action('init', 'hocwp_classifieds_post_type_and_taxonomy', 10);
if ('post.php' == $GLOBALS['pagenow'] || 'post-new.php' == $GLOBALS['pagenow']) {
    $current_user = wp_get_current_user();
    $meta = new HOCWP_Meta('post');
    $meta->add_post_type('post');
    $meta->set_title(__('General Information', 'hocwp-theme'));
    $meta->set_id('classifieds_general_information');
    $meta->add_field(array('id' => 'address', 'label' => __('Address:', 'hocwp-theme'), 'class' => 'hocwp-geo-address', 'default' => get_user_meta($current_user->ID, 'address', true)));
    $meta->add_field(array('id' => 'price', 'label' => __('Price:', 'hocwp-theme')));
    $meta->add_field(array('id' => 'phone', 'label' => __('Phone:', 'hocwp-theme'), 'default' => get_user_meta($current_user->ID, 'phone', true)));
    $meta->add_field(array('id' => 'email', 'label' => __('Email:', 'hocwp-theme'), 'default' => $current_user->user_email));
    $meta->add_field(array('id' => 'acreage', 'label' => __('Acreage:', 'hocwp-theme')));
    $meta->init();
    hocwp_meta_box_editor_gallery(array('post_type' => 'post'));
    hocwp_meta_box_google_maps();
}
function hocwp_classifieds_filter_taxonomy_base($base, $taxonomy)
{
    switch ($taxonomy) {
        case 'classifieds_type':
            $base = hocwp_taxonomy_classifieds_type_base();
            break;
    }
    return $base;
}
add_filter('hocwp_remove_term_base_taxonomy_base', 'hocwp_classifieds_filter_taxonomy_base', 99, 2);
function hocwp_classifieds_scripts()
{
    if (is_single()) {