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 add my plugin interface to the Category Editor. I've easily attached it to the post and page editor using the add_meta_box() filter, but there does not appear to be an add_meta_box hook on the category editor.

So, since I'm already adding some extra fields to the category edit screen using add_filter('edit_category_form', 'my_category_editor_function', 1) I'm wondering if I can just call my plugin script from within that function?

Example:

add_filter('edit_category_form', 'my_category_editor_function', 1);
function my_category_editor_function($tag) {
    $tag_extra_fields = get_option('my_category_editor_function');?>
    <!--This is where I would call my plugin interface-->
    <div style="float:right;top:0;right:0">
    <?php 
        /*
        load my widget here. May have to use some funky css to get it to float 
        to the right of the cat editor just like it does in the post editor
        */
    ?>
    </div>
    <!--This is my current fields added with the filter-->
    <table class="form-table">
    <tr class="form-field">
        <th scope="row" valign="top"><label for="_my-categoryTitle">Category Title</label></th>
        <td><input name="_my-categoryTitle" id="_my-categoryTitle" type="text" size="40" aria-required="false" value="<?php echo $tag_extra_fields[$tag->term_id]['my_cat_title']; ?>" />
        <p class="description">The title is optional but will be used in place of the name on the home page category index (when in list view) and on the category landing page.</p>
        </td>
    </tr>
    <tr class="form-field">
        <th scope="row" valign="top"><label for="_my-categoryKeywords">Keywords</label></th>
        <td valign="top"><input name="_my-categoryKeywords" id="_my-categoryKeywords" type="text" size="40" aria-required="false" value="<?php if(isset($tag_extra_fields[$tag->term_id]['my_cat_keywords']))echo $tag_extra_fields[$tag->term_id]['my_cat_keywords']; ?>" />
        <p class="description">Optional: If you want to add a keywords metatag to the category landing page and keywords in the Category image's alt tag.</p>
        </td>
    </tr>
    <tr class="form-field">
        <th scope="row" valign="top"><label for="_my-categoryImageLink">Image Link</label></th>
        <td valign="top"><input name="_my-categoryImageLink" id="_my-categoryImageLink" type="text" size="40" aria-required="false" value="<?php if(isset($tag_extra_fields[$tag->term_id]['my_cat_imageLink']))echo $tag_extra_fields[$tag->term_id]['my_cat_imageLink']; ?>" />
        <p class="description">Optional: If you want to link the <b>category landing page image</b> to an affiliate or CPA offer, place your link here.</p>
        </td>
    </tr>
    <tr class="form-field">
        <th scope="row" valign="top"><label for="_my-categoryAds">Hide Ads?</label></th>
        <td><input name="_my-categoryAds" id="_my-categoryAds" type="checkbox" style="width:30px;float:left;"<?php if(isset($tag_extra_fields[$tag->term_id]['my_cat_ads'])) echo ' checked="checked"'; ?>" />
        <p class="description"><label for="_my-categoryAds">Check this to remove ads from this category's landing page. (Does not affect ads placed in widgets)</label></p>
        </td>
    </tr>
    </table>
share|improve this question
    
My suggestion is to try it and see. You don't seem to be asking a technical question here. You even seem to have the code written. –  John P Bloch Feb 15 '11 at 17:24
    
@The code you see works fine, I've just stubbed in the comment to show where the new code will go. Perhaps its not clear in my ? but I'm asking what is the proper way to instantiate a plugin from script. –  Scott B Feb 15 '11 at 19:58

1 Answer 1

up vote 1 down vote accepted

you can do that as long as

<!--This is where I would call my plugin interface-->

outputs the HTML form fields.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.