Plugin Directory

Changeset 3419752


Ignore:
Timestamp:
12/15/2025 07:08:31 AM (3 months ago)
Author:
aarti1318
Message:

1.2.0 – added CSS control, placeholder filter, and shortcode class support

Location:
autocomplete-search
Files:
44 added
5 edited

Legend:

Unmodified
Added
Removed
  • autocomplete-search/trunk/README.txt

    r3344494 r3419752  
    44Donate link: https://www.paypal.com/aartichauhan13
    55Requires at least: 5.0
    6 Tested up to: 6.8.2
     6Tested up to: 6.9
    77Requires PHP: 7.2
    8 Stable tag: 1.1.0
     8Stable tag: 1.2.0
    99Author: Aarti Chauhan
    1010License: GPLv2 or later
     
    48484. Add the Search Box
    4949Use the [atcl_autocomplete_search] shortcode to display the search box on any post, page, or widget area.
     50
     51You can also pass a custom CSS class to style the search box differently in your theme:
     52
     53[atcl_autocomplete_search class="header-search"]
     54
     55This allows full control over the appearance using your theme’s CSS.
     56
    5057
    5158== Frequently Asked Questions ==
     
    103110* Updated settings page UI for better usability.
    104111* Minor bug fixes and code optimizations.
     112
     113
     114= 1.2.0 =
     115* Added theme-level control for search box styling via filters and CSS classes.
     116* Added filter to customize the search input placeholder text.
     117* Added support for custom wrapper and input field CSS classes.
     118* Added shortcode attribute to allow custom CSS classes per search instance.
     119* Minor code refactoring and performance optimizations.
     120
     121
     122== Developers ==
     123
     124The plugin provides filters to allow theme and plugin developers to customize output:
     125
     126* `atcl_autocomplete_search_placeholder` – Filter the search input placeholder text.
     127* `atcl_autocomplete_search_wrapper_class` – Filter the wrapper CSS classes.
     128* `atcl_autocomplete_search_input_class` – Filter the input field CSS classes.
     129
     130Shortcode attributes:
     131* `class` – Add a custom CSS class to the search wrapper.
     132
     133Example:
     134[atcl_autocomplete_search class="header-search"]
  • autocomplete-search/trunk/admin/includes/settings.php

    r3203104 r3419752  
    9696            }
    9797           
    98             $post_types = get_post_types( array( 'exclude_from_search' => false ), 'objects' );
     98            $post_types = get_post_types(
     99                array(
     100                    'public'   => true,
     101                    'show_ui'  => true,
     102                ),
     103                'objects'
     104            ); 
    99105           
    100106            ?>
     
    115121                                </tr>
    116122                                <?php
    117                                 foreach($post_types as $key => $type) {  if( $key == "attachment" ) continue;?>
     123                                foreach($post_types as $key => $type) {  if( $key == "attachment" ) continue;
     124
     125
     126                                ?>
    118127                                <tr>
    119128                                <td>
  • autocomplete-search/trunk/autocomplete-search.php

    r3344488 r3419752  
    33 * Plugin Name:       Autocomplete Search
    44 * Description:       Easily add an autocomplete search feature to your WordPress site. Search across posts, pages, and WooCommerce products with a fast, AJAX-powered search box. [atcl_autocomplete_search]
    5  * Version:           1.1.0
     5 * Version:           1.2.0
    66 * Requires PHP:      7.2
    77 * Author:            Aarti Chauhan
    8  * Author URI:          https://profiles.wordpress.org/aarti1318/
     8 * Author URI:        https://profiles.wordpress.org/aarti1318/
    99 * Contributors:      aarti1318
    1010 * License:           GPL-2.0+
     
    2323 * Rename this for your plugin and update it as you release new versions.
    2424 */
    25 define('ATCL_AUTOCOMPLETE_SEARCH_VERSION', '1.1.0');
     25define('ATCL_AUTOCOMPLETE_SEARCH_VERSION', '1.2.0');
    2626define('ATCL_IMAGES_URL', plugins_url('/autocomplete-search/public/images/', dirname(__FILE__)));
    2727/**
  • autocomplete-search/trunk/includes/shortcodes.php

    r3344488 r3419752  
    5151    }
    5252    /**
    53      * atcl_autocomplete_callback the function to denfinr the [wp_autocomplete] shortcode.
     53     * atcl_autocomplete_callback the function to denfinr the [atcl_autocomplete_search] shortcode.
    5454     *
    55      * @since 1.0.0
     55     * @since 1.2.0
    5656     * @param string $atts    The attributes for the shortcode.
    5757     * @param string $content The content of the shortcode.
    5858     */
    59     public function atcl_autocomplete_callback( $atts, $content = '' )
    60     {
     59    public function atcl_autocomplete_callback( $atts, $content = '' ) {
     60
     61        // Allow shortcode attributes
     62        $atts = shortcode_atts(
     63            array(
     64                'class' => '', // custom class from shortcode
     65            ),
     66            $atts,
     67            'autocomplete_search'
     68        );
     69
     70        // Placeholder text (theme / plugin can override)
     71        $placeholder = apply_filters(
     72            'atcl_autocomplete_search_placeholder',
     73            __( 'I’m searching for…', 'autocomplete-search' )
     74        );
     75
     76        // Wrapper class filter
     77        $wrapper_class = apply_filters(
     78            'atcl_autocomplete_search_wrapper_class',
     79            'site-search ajax-search'
     80        );
     81
     82        // Input field class filter
     83        $input_class = apply_filters(
     84            'atcl_autocomplete_search_input_class',
     85            'search-field'
     86        );
     87
    6188        ob_start();
    6289        ?>
    63         <div class="site-search ajax-search">
     90        <div class="<?php echo esc_attr( $wrapper_class . ' ' . $atts['class'] ); ?>">
    6491            <div class="widget widget_search">
    6592                <div class="ajax-search-result d-none"></div>
     93
    6694                <form role="search" method="get" class="wp-search" action="">
    67                     <label class="screen-reader-text" for="wp-search-field-1"><?php esc_html_e( 'Search for:', 'autocomplete-search' ); ?></label>
    68                     <input type="search" id="wp-search-field-1" class="search-field" placeholder="<?php echo esc_attr__( 'I’m searching for…', 'autocomplete-search' ); ?>" autocomplete="off" value="" name="s">
    69         <?php wp_nonce_field('form_action', 'submit_form'); ?>
    70                     <button type="submit" value="<?php echo esc_attr__( 'Search', 'autocomplete-search' ); ?>"> <?php echo esc_html__( 'Search', 'autocomplete-search' ); ?></button>
     95                    <label class="screen-reader-text" for="wp-search-field-1">
     96                        <?php esc_html_e( 'Search for:', 'autocomplete-search' ); ?>
     97                    </label>
     98
     99                    <input
     100                        type="search"
     101                        id="wp-search-field-1"
     102                        class="<?php echo esc_attr( $input_class ); ?>"
     103                        placeholder="<?php echo esc_attr( $placeholder ); ?>"
     104                        autocomplete="off"
     105                        value=""
     106                        name="s"
     107                    >
     108
     109                    <?php wp_nonce_field( 'form_action', 'submit_form' ); ?>
     110
     111                    <button type="submit">
     112                        <?php echo esc_html__( 'Search', 'autocomplete-search' ); ?>
     113                    </button>
     114
    71115                    <input type="hidden" name="post_type" value="product">
     116                </form>
     117            </div>
     118        </div>
     119        <?php
    72120
    73                 </form>
    74                 </div>
    75             </div>
    76         <?php
    77         $content .= ob_get_clean();
     121        return $content . ob_get_clean();
     122    }
    78123
    79         return $content;
    80     }
    81124}
  • autocomplete-search/trunk/public/class-autocomplete-search-public.php

    r3344488 r3419752  
    9696         * class.
    9797         */
     98         $lang = '';
    9899         if ( function_exists( 'pll_current_language' ) ) {
    99100                $lang = pll_current_language();
Note: See TracChangeset for help on using the changeset viewer.