From 9024d31b18157ac7b7a60a5fcfd0463e23e49cb7 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 17 Nov 2015 13:54:38 -0500 Subject: [PATCH] Testing quicksearch --- functions.php | 146 +++++++++++++++++++++ js/quicksearch/jquery.quicksearch.js | 181 +++++++++++++++++++++++++++ page.php | 17 +++ 3 files changed, 344 insertions(+) create mode 100644 js/quicksearch/jquery.quicksearch.js diff --git a/functions.php b/functions.php index cddd90e..90a6aee 100644 --- a/functions.php +++ b/functions.php @@ -413,6 +413,17 @@ function my_ajax_callback_function() { add_action('wp_enqueue_scripts', 'glm_site_scripts'); +function glm_admin_scripts($hook) { + if ('post.php' != $hook) { + return; + } + wp_enqueue_script( + 'jquery-quicksearch', + get_template_directory_uri() . '/js/quicksearch/jquery.quicksearch.js', + 'jquery' + ); +} +add_action('admin_enqueue_scripts','glm_admin_scripts'); // Start of the Contextual/Highlight Search functions function mytheme_init() { @@ -464,4 +475,139 @@ add_action('thematic_searchloop', 'mytheme_search_loop'); //} //add_filter('the_content', 'custom_content'); +//function save_postdata($postid) +//{ +// if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false; +// if ( !current_user_can( 'edit_page', $postid ) ) return false; +// if(empty($postid) || $_POST['post_type'] != 'article' ) return false; +// +// if($_POST['action'] == 'editpost'){ +// delete_post_meta($postid, 'publish_in_frontpage'); +// } +// +// add_post_meta($postid, 'publish_in_frontpage', $_POST['publish_in_frontpage']); +//} +//add_action( "save_post_page", "glm_save_post_page" ); +//function glm_save_post_page( $post_ID ) +//{ +// if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) +// return $post_ID ; +// +// if( isset( $_POST['input_name'] )) +// { +// update_post_meta( $post_ID, '_w4_template', $_POST['input_name'] ); +// } +//} + +add_action( 'add_meta_boxes', 'glm_add_meta_box' ); + +// Register Your Meta box +function glm_add_meta_box( $post ) +{ + $screens = array( 'post', 'page' ); + + foreach ( $screens as $screen ) { + + add_meta_box( + 'glm_member_categories', // this is HTML id + 'GLM MemberDB Categories', + 'glm_member_categories_callback', // the callback function + 'page', // register on post type = page + 'side', // + 'core' + ); + } +} +function glm_member_categories_callback( $post ) +{ + global $wpdb; + global $config; + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); + $glmcat = new GlmDataCategories($wpdb, $config); + $dispcat = $glmcat->getList(); + $dispcatsorted = $glmcat->sortParentChild($dispcat); + +$term = null; +$btn = __('Search'); +if ( is_category() ) { $term = get_queried_object(); } +echo '
'; +echo '