• I am in the process of creating a custom admin panel which has a specific page for adding/editing each of the different categories of posts.

    For a couple of the categories, the ‘Add New Post’ page differs very little from the original therefore I was hoping to avoid re-programming all of the available features.

    In my plugin file, I add the admin_menu action to create a panel and define the linking action in the function content_special_category_update_edit()

    add_menu_page(‘Special Category Updates’, ‘Special Category Updates’, 8, __FILE__, ‘content_special_category_update_edit’)

    Within the function content_special_category_update_edit(), I start by copying the contents of post-new.php exactly.

    function content_special_category_update_edit(){

    /** Load WordPress Administration Bootstrap */
    require_once(‘admin.php’);
    $title = __(‘Add New NTI Update’);
    $parent_file = ‘edit.php’;
    $editing = true;
    wp_enqueue_script(‘autosave’);
    wp_enqueue_script(‘post’);
    if ( user_can_richedit() )
    wp_enqueue_script(‘editor’);
    add_thickbox();
    wp_enqueue_script(‘media-upload’);
    wp_enqueue_script(‘word-count’);

    if ( ! current_user_can(‘edit_posts’) ) {
    require_once (‘./admin-header.php’); ?>
    <div class=”wrap”>
    <p><?php printf(__(‘Speak with an admin to add the edit_posts capability to your user account, in order to be authorized to post.
    ‘)); ?>
    </p>
    </div>
    <?php
    include(‘admin-footer.php’);
    exit();
    }

    // Show post form.
    $post = get_default_post_to_edit();
    include(‘edit-form-advanced’);

    }

    The resulting page looks as it should and allows the publication of posts, but none of the javascript functionality works.

    I tried copying the folder wp-admin/js into my_plugin/js but that didn’t help anything.

    Any thoughts????

    thanks,
    mido

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Javascript for admin panel customization plugin’ is closed to new replies.