Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to load tag-it jquery plugin into the wordpress back-end for the category edit page, but for some reason I can't.

The following are snippets of my code:

function tag_category_fields($tag){
    $t_id = $tag->term_id;
    $cat_meta = get_option( "category_$t_id");
    $tag_items_list = individual_tag();
    ?>

    <tr class="form-field">
    <th scope="row" valign="top"><label for="category_tag_list"><?php _e('Available Categary Tags'); ?></label></th>
    <td>
    <form class="category_tag_list_values">
    <select id="list_category_tags" name="list_category_tags" style="width: 300px; padding: 5px; overflow-y: auto;" multiple="multiple">
    <?php foreach($tag_items_list as $tags){ ?>
        <option value="<?php echo $tags->tag_id ?>"><?php echo $tags->name ?></option>
    <?php } ?>    
    </select>
    <br/>
    <input class="uibutton" style="width: 75px" type="button" value="add">
    </form>
    <br />
    </td>
    </tr>
    <tr class="form-field">
    <th scope="row" valign="top"><label for="added_category_tag"><?php _e('Current Category Tags'); ?></label></th>
    <td>
                <input id="myTags" type="text" /><br />
                <p id="status"></p>
                <span class="description"><?php _e('Current Category Tags'); ?></span>
            </td>
    </tr>
    <?php
}

This is the html for the added boxes on the page:

   function my_plugin_admin_init() {
        wp_enqueue_script( 'myTagScript', 
        plugins_url( '/js/tag-it.js' , __FILE__ ));
        wp_enqueue_script( 'myCategoryTagScript', 
        plugins_url( '/js/category_tags.js' , __FILE__ ));
        wp_enqueue_script("myUi","https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js");
   }

function my_plugin_admin_scripts() {
        wp_enqueue_script( 'myTagScript' );
        wp_enqueue_script( 'myCategoryTagScript' );

   }

How I'm loading the scripts for the pages:

jQuery(document).ready(function($){
    $("form :button").click(function() {
    alert($('#list_category_tags').val());
    });


    $('#myTags').tagit();
});

I'm using this plug-in https://github.com/aehlke/tag-it

share|improve this question
    
Could you please use punctuation and make separate sentences? This is really hard to read and understand. Thank you. –  kaiser Jul 7 '13 at 11:45
    
Where do you have the jQuery(document) code? Does tag-it.js use the $ alias? Have you checked the console for Javascript errors? –  s_ha_dum Jul 7 '13 at 15:55
    
I'm using this plugin github.com/aehlke/tag-it, I did try $ alias it didn't seem to work tho but I may have done it wrong. –  user7715 Jul 7 '13 at 17:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.