Created
May 20, 2012 14:19
-
-
Save imjjss/2758279 to your computer and use it in GitHub Desktop.
Find Posts Dialog Box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://shibashake.com/wordpress-theme/find-posts-dialog-box | |
<?php | |
?> | |
<form name="plugin_form" id="plugin_form" method="post" action=""> | |
<?php wp_nonce_field('plugin_nonce'); ?> | |
// Other form elements and code ... | |
<?php find_posts_div(); ?> | |
</form> | |
<?php | |
//attach our dialog box to a link or button by using the Javascript onclick event | |
?> | |
<a onclick="findPosts.open('action','find_posts');return false;" href="#"> | |
<?php esc_attr_e('Example Post Search'); ?> | |
</a> | |
<?php | |
add_action("admin_print_styles", 'plugin_admin_styles' ); | |
add_action("admin_print_scripts", 'plugin_admin_scripts' ); | |
function plugin_admin_styles() { | |
wp_enqueue_style('thickbox'); // needed for find posts div | |
} | |
function plugin_admin_scripts() { | |
wp_enqueue_script('thickbox'); // needed for find posts div | |
wp_enqueue_script('media'); | |
wp_enqueue_script('wp-ajax-response'); | |
} | |
/* | |
return value: | |
$_POST['action'] = ‘find_posts’ | |
$_POST['found_post_id'] = post object selected | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment