wp plugin -8

do_action( $tag, $arg = ‘’ );

$tag — The name of the action hook.

$arg — Value(s) passed to registered actions. It looks like a single parameter, but this isn ’ t always the case. Action hooks have the option to pass any number of parameters or no parameters at all. You need to check the WordPress source code for specifi c hooks because the number of parameters changes on a per - hook basis.

< ?php

do_action( $tag, $arg_1, $arg_2, $arg_3 );

? >

< ?php

do_action(‘save_post’, $post_ID, $post);

? >

 

add_action( $tag, $function, $priority, $accepted_args );

$tag — The name of the action hook your function executes on.

$function — The name of your function that WordPress calls.

$priority — An integer that represents the order in which the action is fi red. When no value is given, it defaults to 10 . The lower the number, the earlier the function will be called. The higher the number, the later it will be called.

$accepted_args — The number of parameters the action hook will pass to your function. By default, it passes only one parameter.

 

< ?php

add_action( ‘wp_footer’, ‘boj_example_footer_message’, 100 );

function boj_example_footer_message() {

echo ‘This site is built using < a href=”http://wordpress.org”

title=”WordPress publishing platform” > WordPress < /a > .’;

}

?

posted on 2012-12-03 18:10  kalintw  阅读(98)  评论(0)    收藏  举报

导航