我有以下功能。php。是否可以仅在某些自定义帖子类型上加载它们?(我有一些自定义帖子类型,它们都使用某个模板部分->是否可以在其中添加功能?)或者只能将add\\u action与函数一起使用。php?
add_action( \'get_header\', \'tsm_do_logged_in_author_checks\' );
function tsm_do_logged_in_author_checks() {
// Get current user info
global $post,$current_user;
get_currentuserinfo();
// Bail if user is not logged in and not post author
if (// ! ( is_user_logged_in() && $current_user->ID == $post->post_author )
is_admin()) {
return;
}
add_action( \'wp_enqueue_scripts\', \'tsm_acf_form_edit_post_enqueue_scripts\' );
add_action( \'get_header\', \'tsm_do_acf_form_head\', 1 );
add_action( \'wp_print_styles\', \'tsm_deregister_admin_styles\', 999 );
add_action( \'loop_start\', \'tsm_do_acf_form_edit_toggle\', 5 );
add_action( \'loop_end\', \'tsm_do_acf_form_content\' );
add_filter( \'acf/load_value/key=field_54dfc93e35ec4\', \'tsm_load_post_title\', 10, 3 );
function tsm_acf_form_edit_post_enqueue_scripts() {
wp_enqueue_script( \'sidr\', get_stylesheet_directory_uri() . \'/assets/js/jquery.sidr.min.js\', array( \'jquery\' ), \'1.2.1\', true );
wp_enqueue_script( \'edit-post\', get_stylesheet_directory_uri() . \'/assets/js/edit-post.js\', array( \'sidr\' ), \'1.0.0\', true );
}
function tsm_do_acf_form_head() {
acf_form_head();
}
function tsm_deregister_admin_styles() {
wp_deregister_style( \'wp-admin\' );
}
etc etc...