Okay
  Public Ticket #147421
"undefined" when searching for custom post
Closed

Comments

  • Paul started the conversation
    Hello... I've set up custom posts, and when I use the search feature, it will find the posts in the auto-fill feature, but lists them as "undefined"... how can I change "undefined" to "News item"? Thanks
  •  1,077
    ThemeNectar replied

    Hey Paul!

    Open up the wp-search-suggest.php located in the nectar/assets/functions/ajax-search directory and find this:

    else if(get_post_type($post->ID) == 'product'){			
    	$suggestion['post_type'] = __('Product',NECTAR_THEME_NAME); 
    }

    below that, you can add your own in like this:

    else if(get_post_type($post->ID) == 'news'){
    	$suggestion['post_type'] = __('News Items',NECTAR_THEME_NAME); 
    }

    Just make sure the get_post_type($post->ID) == 'news' matches your custom post type name.

    Cheers :)