WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] First plugin coding. Help Me Please :'( (9 posts)

  1. Karbon8
    Member
    Posted 5 years ago #

    Hi all :)

    I have to create a plugin for my work and I'm already lose with all these hooks/functions and little thing that provide Plugin API :(

    For the moment I have to add some input in the Manage > Category menu so that I will able to add keywords under "Description".

    I don't really know if you can understand me (frenchie sux xD) so I made a screenshot of what I want:
    http://img91.imageshack.us/img91/7941/whereit6.jpg

    So I have to add 2 input here so that when someone create or modify category he can add keywords.

    I've tried to add one of those hooks:

    add_action('create_category', 'my_func');
    add_action('add_category', 'my_func');

    and then in the my_func() function to "echo" something but it looks like it doesn't work :(

    Can someone help me please?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Try using the "edit_link_category_form" hook instead.

  3. Karbon8
    Member
    Posted 5 years ago #

    But actually where do you find it? There's nothing about that in the documentation (http://wordpress.org/search/edit_link_category_form)

    Hum, it seems like there's a 'edit_category_form' but damn, I can't understand such a thing -_-'

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    The documentation is not complete, so I found it by looking at the actual WordPress code.

    At the bottom of edit-link-category-form.php is where it makes the call to the 'edit_link_category_form' action.

    Edit: Whoops, I was looking at Link Categories. My bad. You are correct, use the 'edit_category_form' action hook.

  5. Karbon8
    Member
    Posted 5 years ago #

    Does it meen that when there is something like this in core's code:
    <?php do_action('edit_link_category_form', $category); ?>
    'edit_link_category_form' is a action hook :/ ?

  6. Karbon8
    Member
    Posted 5 years ago #

    Ok, actually it looks like it works: http://img140.imageshack.us/img140/7838/thankyouag6.jpg :P

    Thanks man, cya for another question ^^

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Does it meen that when there is something like this in core's code:
    <?php do_action('edit_link_category_form', $category); ?>
    'edit_link_category_form' is a action hook :/ ?

    Yes, that's exactly what it means.

  8. Karbon8
    Member
    Posted 5 years ago #

    Hey, back again with another question ^^

    I finally created my 2 new inputs in the Category Form and I can see them under the submit button ( http://img201.imageshack.us/img201/390/inputproblemml0.jpg ). But actually where does the 2 new datas go when the User will submit?

    According to the core code:

    <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" />
    
    <?php do_action('edit_category_form', $category); ?>
    </form>

    My 2 new data are a part of the form so they will be treated in the "categories.php". But because it's not a part of the default settings there is nothing about them in the categories.php file :/ Where can I catch them?

    I think I can create a new form with the help of Javascript and flip the hook so the final code will look like that:

    <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" />
    
    <!-- Here was the hook but It will be placed under thanks to JS -->
    </form>
    <form name="my_form" id="my_form_cat" method="post" action="my_plugin.php">
    </form>

    And then I will be able to play with my form, but what about if User disable JS :S ? Is it a good solution?

  9. 4thfloor
    Member
    Posted 4 years ago #

    Actually I think you can use edit_category_form_fields to do as you are suggesting as opposed to edit_category_form.

    I really wish that there was more documentation on this though as I've been trying to add fields to the category form for each category but it's tough to find any info on it.

    I unfortunately have NO IDEA how to submit those form fields to the database. >_<

Topic Closed

This topic has been closed to new replies.

About this Topic