Results 1 to 3 of 3

Thread: is it possible to add ad-tag to search bar?

  1. #1
    Thread Starter
    Expired Customer bidakkabi's Avatar
    Join Date
    Mar 2018
    Posts
    99
    Thanks
    10
    Thanked 1 Time in 1 Post

    is it possible to add ad-tag to search bar?

    Hello
    searchform-listing.php I want to edit this file.

    current file
    Code:
    <?php
    /**
     * The listing search form template file
     *
     * @package ClassiPress
     * @since 4.0.0
     */
    
    if ( ! isset( $search_form_location ) ) {
    	$search_form_location = 'bar';
    }
    $is_widget       = 'widget' === $search_form_location;
    $location_search = false;
    $states_field_token = '';
    
    $form_fields = $wpdb->get_results( "SELECT * FROM $wpdb->cp_ad_fields ORDER BY field_id asc" );
    $states_field = wp_list_filter( $form_fields, array( 'field_name' => 'cp_state' ) );
    
    if ( ! empty( $states_field ) ) {
    	$location_search = true;
    	$states_field    = array_shift( $states_field );
    	$select_options  = cp_explode( ',', $states_field->field_values );
    	$select_options  = array_filter( $select_options );
    	$html_options = '';
    	$html_options .= html( 'option', array( 'value' => '' ), __( 'Tüm Şehirler', APP_TD ) );
    	$cp_state = '';
    	if ( ! empty( $_GET['cp_state'] ) && is_array( $_GET['cp_state'] ) ) {
    		$cp_state = $_GET['cp_state'];
    		$cp_state = array_shift( $cp_state );
    	}
    	foreach ( $select_options as $option ) {
    		$args = array( 'value' => $option );
    		if ( ( $option === $cp_state ) || ( esc_attr( $option ) === $cp_state ) ) {
    			$args['selected'] = 'selected';
    		}
    		$html_options .= html( 'option', $args, $option );
    	}
    	$args  = array( 'name' => $states_field->field_name . '[]', 'id' => $states_field->field_name );
    	$states_field_token =  html( 'select', $args, $html_options );
    }
    ?>
    <script type="text/javascript">
    	jQuery( function( $ ) {
    		$('.search-form').submit( function () {
    			$( this )
    				.find('.search-state-wrap select')
    				.filter( function () {
    					return !this.value;
    				} )
    				.prop( 'name', '' );
    		});
    	} );
    </script>
    <form method="get" class="search-form" action="<?php echo esc_url( get_post_type_archive_link( APP_POST_TYPE ) ); ?>" role="search">
    	<div class="row">
    		<div class="search-keywords-wrap medium-<?php echo $is_widget ? 12 : ( $location_search ? 4 : 5 ); ?> columns">
    			<input name="s" type="search" id="search_keywords" class="search_keywords" value="<?php the_search_query(); ?>" placeholder="<?php echo esc_attr_x( 'What are you looking for?', 'placeholder text', APP_TD ); ?>" />
    		</div>
    		<?php if ( $location_search ) { ?>
    			<div class="search-state-wrap medium-<?php echo $is_widget ? 12 : 3; ?> columns">
    				<?php echo $states_field_token; ?>
    			</div><!-- .search-state-wrap -->
    		<?php } ?>
    		<div class="search-category-wrap medium-<?php echo $is_widget ? 12 : ( $location_search ? 3 : 5 ); ?> columns">
    			<?php wp_dropdown_categories( cp_get_dropdown_categories_search_args( $search_form_location ) ); ?>
    		</div>
    		<div class="search-button-wrap medium-<?php echo $is_widget ? 12 : 2 ?> columns">
    			<button type="submit" class="button expanded">
    				<i class="fa fa-search" aria-hidden="true"></i>
    				<?php esc_html_e( 'Search', APP_TD ); ?>
    			</button>
    		</div>
    		<?php
    		/**
    		 * Fires after the main header search fields.
    		 *
    		 * @since 4.0.0
    		 */
    		do_action( 'cp_listing_header_search_fields_after' );
    		?>
    		<input type="hidden" name="lat" value="<?php echo ! empty( $_GET[ 'lat' ] ) ? esc_attr( $_GET[ 'lat' ] ) : 0; ?>">
    		<input type="hidden" name="lng" value="<?php echo ! empty( $_GET[ 'lng' ] ) ? esc_attr( $_GET[ 'lng' ] ) : 0; ?>">
    		<input type="hidden" name="st" value="<?php echo esc_attr( APP_POST_TYPE ); ?>">
    		<input type="hidden" name="refine_search" value="yes">
    	</div> <!-- .row -->
    </form>
    I want to remove the code below and extract the list of ad-tags instead

    just like cp_state

    Code:
    <input name="s" type="search" id="search_keywords" class="search_keywords" value="<?php the_search_query(); ?>" placeholder="<?php echo esc_attr_x( 'What are you looking for?', 'placeholder text', APP_TD ); ?>" />

  2. #2
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,966
    Thanks
    169
    Thanked 3,406 Times in 3,277 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  3. #3
    Thread Starter
    Expired Customer bidakkabi's Avatar
    Join Date
    Mar 2018
    Posts
    99
    Thanks
    10
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: November 12th, 2020, 04:46 AM
  2. Replies: 6
    Last Post: March 28th, 2018, 12:07 PM
  3. Replies: 4
    Last Post: May 21st, 2014, 03:50 AM
  4. Replies: 2
    Last Post: July 27th, 2012, 03:18 PM