Example #1
0
/**
 * Adds a new tab in the media browser.
 */
function gp_slider_tab($tabs)
{
    global $wpdb;
    $post_id = it_get_post_id();
    $tabs['gp_slider'] = __('Slider', 'gp');
    return $tabs;
}
Example #2
0
/**
 * Initialize Portfolio Admin
 */
function gp_portfolio_admin_init()
{
    global $pagenow;
    $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : '';
    if ($post_id = it_get_post_id()) {
        $post = get_post($post_id);
        $post_type = $post->post_type;
    }
    if ($post_type == 'gp_portfolio') {
        // Project List Page
        if ('edit.php' == $pagenow) {
            // Set correct order of projects in admin.
            add_filter('pre_get_posts', 'gp_portfolio_admin_project_order');
            // Custom columns in Project List
            add_filter('manage_edit-gp_portfolio_columns', 'gp_portfolio_admin_project_list_columns');
            add_action('manage_posts_custom_column', 'gp_portfolio_project_list_column_data');
        }
        // Post Edit or Post New Page
        if (in_array($pagenow, array('post.php', 'post-new.php', 'admin-ajax.php'))) {
            new PortfolioProjectAdmin($post_id);
        }
    }
    if ($post_id) {
        if (it_is_template($post_id, 'template-portfolio-grid.php')) {
            new GridPortfolioAdmin($post_id);
        }
    }
}
Example #3
0
/**
 * Initialize Admin-Side Post Format.
 */
function gp_background_admin_init()
{
    $post_id = it_get_post_id();
    if ($post_id) {
        if (it_is_template($post_id, 'template-background.php')) {
            wp_enqueue_script('gp-wp-admin-background', get_template_directory_uri() . '/js/wp-admin/background.js');
            wp_enqueue_style('gp-wp-admin-background', get_template_directory_uri() . '/css/wp-admin/background.css');
            add_action('add_meta_boxes', 'gp_background_add_meta_box');
        }
    }
}
Example #4
0
/**
 * Initialize admin side.
 */
function gp_contacts_admin_init()
{
    $post_id = it_get_post_id();
    if ($post_id) {
        /**
         * Initialize scripts & styles.
         */
        wp_enqueue_script('gp-wp-admin-contacts', get_template_directory_uri() . '/js/wp-admin/contacts.js');
        /**
         * If current type is contacts, then add meta box to admin area.
         */
        if (it_is_template($post_id, 'template-contacts.php')) {
            add_action('add_meta_boxes', 'gp_contacts_add_meta_box');
        }
    }
}