Modifying the default search widget

Question

I’m creating a plugin widget that does a different search from the normal default search widget. I copied the code from the default widget:

class new_search extends WP_Widget {


             function __construct() {
                    $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for NextGen photos") );
                    parent::__construct('search', __('NGGSearch'), $widget_ops);
            }

            function widget( $args, $instance ) {
                    extract($args);
                    $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );

                    echo $before_widget;
                    if ( $title )
                            echo $before_title . $title . $after_title;

                    // Use current theme search form if it exists
                    get_search_form();

                    echo $after_widget;
            }

            function form( $instance ) {
                    $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
                    $title = $instance['title'];
    ?>
                    <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
    <?php
            }

            function update( $new_instance, $old_instance ) {
                    return;
            $instance = $old_instance;
                    $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
                    $instance['title'] = strip_tags($new_instance['title']);
                    return $instance;
            }





    } // end class example_widget
    add_action('widgets_init', create_function('', 'return register_widget("new_search");'));
    ?>

I’m having trouble finding where this default search widget calls the search.php function. Basically I want to create my own search.php function (AKA searchNew.php) and call it when the user hits search. Any ideas where search.php is called so I can replace it with a different file?

Edit: I’ve looked in the searchform.php file already (the one called by get_search_form) and nothing there seems to suggest it’s calling search.php

0
, Conrad S 7 years 2014-11-10T22:08:10-05:00 0 Answers 64 views 0

Leave an answer

Browse
Browse