plugin = new stdClass(); $this->plugin->name = 'full-screen-morphing-search'; $this->plugin->folder = plugin_dir_path( __FILE__ ); $this->plugin->url = plugin_dir_url( __FILE__ ); // Add actions if we're not in the WordPress Administration to load CSS, JS and the Morphing Search HTML. if ( ! is_admin() ) { add_action( 'wp_head', array( $this, 'full_screen_morphing_search_enqueue_css_js' ) ); add_action( 'wp_footer', array( $this, 'full_screen_morphing_search_output_morphing_search' ) ); } } /** * Loads the CSS and JS used for this plugin. * * @since 1.1 */ public function full_screen_morphing_search_enqueue_css_js() { // Load CSS. wp_enqueue_style( $this->plugin->name, $this->plugin->url . 'assets/css/full-screen-morphing-search.css', array(), '1.0', false ); // Require WordPress jQuery. wp_enqueue_script( 'jquery' ); // Require jquery-ui-core and jquery-ui-autocomplete for autoco;pletition search ! wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-autocomplete' ); // Load Javascript. wp_enqueue_script( $this->plugin->name, $this->plugin->url . 'assets/js/full-screen-morphing-search.js', array( 'jquery' ), '1.0', true ); wp_localize_script( $this->plugin->name, 'fsmsp_vars', array( 'fsmsp_is_customize_preview' => is_customize_preview(), ) ); } /** * Outputs the HTML markup for our Full Screen Morphing Search * CSS hides this by default, and Javascript displays it when the user * interacts with any WordPress search field * * @since 1.1 */ public function full_screen_morphing_search_output_morphing_search() { $fsmsp_options = get_option( 'fsmsp_options' ); // Associative Array 'fsmsp_options'. // Setting the placeholder as a variable to output the option depending on the case. $fsmsp_placeholder = $fsmsp_options['fsmsp_search_form_text']; // Selecting the key to get the value. if ( ! empty( $fsmsp_placeholder ) ) { $fsmsp_placeholder = esc_attr( $fsmsp_placeholder ); } else { $fsmsp_placeholder = esc_attr_x( 'Search …', 'placeholder', 'full-screen-morphing-search' ); } ?>