Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Scott (@scottsweb)

    (@scottsweb)

    Sounds like it could possibly be a bug – although it worked during my tests locally a few weeks ago.

    Do you have a link to the site your testing the plugin on?

    Thread Starter Jarod Thornton

    (@jarmerson)

    Thank you for the response.

    iemajen.com/anntowergallery/exhibits/

    Click on the Past Exhibits

    Plugin Author Scott (@scottsweb)

    (@scottsweb)

    Odd. I cannot reproduce this locally.

    Can you change the following line of code: https://github.com/scottsweb/instant-search-suggest/blob/master/assets/inc/iss-ajax.php#L62

    $results = wp_cache_get( 'wpiss_' . sanitize_title_with_dashes( $s ) );

    to:

    $results = false;

    This will eliminate caching as a possible explanation.

    Thanks

    Thread Starter Jarod Thornton

    (@jarmerson)

    I made the edit but it is still pulling pages and posts. I did a search for contact and it pulls the pages too. It’s not a deal breaker by any means, but I would like to force the search results to the custom posts types alone, as is in settings.

    Plugin Author Scott (@scottsweb)

    (@scottsweb)

    One last thing to try. Can you download the version here: https://github.com/scottsweb/instant-search-suggest and try that.

    I made a few little changes recently and I am hoping it will solve your issue.

    Let me know how you get on.

    Thread Starter Jarod Thornton

    (@jarmerson)

    I’ve updated the plugin with your github copy without luck.

    I did have to finagle the template code but did so in my own plugin. Here’s the code I’ve used to customize the search results.

    if ( ! function_exists('is_plugin_active'))
    					{
    require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
    					}
    if (is_plugin_active('instant-search.php'))
    {
    #  Custom Instant Search Suggestions
    /**
     * Output a filterable jQuery template for rendering post type search suggestions
     *
     * @return string jQuery template
     */
    function wpiss_post_template() {
    
    	$template  = '
    
    	<div class="search-results-style">
    	<script type="x-tmpl-mustache" id="wpiss-post-template">
    		<li class="iss-result">
    			{{#image}}
    				<img src="{{image}}" width="50" height="50" />
    			{{/image}}
    			{{{title}}}
    			<span class="iss-sub">{{posttype}}</span>
    		</li>
    	</script>
    	</div>';
    
    	echo apply_filters( 'wpiss_post_tempalte', $template );
    }
    add_action( 'wp_footer', 'wpiss_post_template');
    
    /**
     * Output a filterable jQuery template for rendering taxonomy search suggestions
     *
     * @return string jQuery template
     */
    function wpiss_taxonomy_template() {
    
    	$template  = '
    	<script type="x-tmpl-mustache" id="wpiss-taxonomy-template">
    		<li class="iss-result">
    			{{{title}}}
    			<span class="iss-sub">{{taxonomy}}</div>
    		</li>
    	</script>';
    
    	echo apply_filters( 'wpiss_taxonomy_template', $template );
    }
    add_action( 'wp_footer', 'wpiss_taxonomy_template');
    
    }

    Do you see anything that might cause an issue?

    Plugin Author Scott (@scottsweb)

    (@scottsweb)

    Ideally you would use the filters wpiss_post_template and wpiss_taxonomy_template to filter the output of the plugin. It looks like you are adding your own actions above and not removing the actions from the plugin.

    Regardless, this should not impact the returned suggestions

    It has me wondering if you have incorrectly registered your custom post types, they may not be available during the AJAX requests to wp-admin and therefore causing an issue.

    Thread Starter Jarod Thornton

    (@jarmerson)

    Thank you for the follow up.

    Are you suggesting revisions to my template above? I’m a novice and the filtering is above my head. If you don’t mind pointing me in the right direction I would greatly appreciate it.

    As for the registered custom post types, they are listed in the options as a selection to choose from. It’s a theme by MySiteMyWay – https://mysitemyway.com/theme/echelon-wordpress-theme/

    I don’t believe they would have coded it incorrectly.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom Post Type in Search Suggest’ is closed to new replies.