WordPress.org

Ready to get started?Download WordPress

Forums

WP Custom Fields Search
Custom Taxonomies (2 posts)

  1. krembo99
    Member
    Posted 9 months ago #

    This looks like a great plugin !
    I think addding Custom Taxonomies to the mix would make this plugin really complete . would that be a future feature ?

    http://wordpress.org/plugins/wp-custom-fields-search/

  2. yemikudaisi
    Member
    Posted 4 months ago #

    it is actually quite easy to implement it on your one. It required only a few lines of code.

    Step 1: Extend the CategoryJoiner for your custom taxonomy in the 'extra_search_fields.php' file

    class CustomTaxonomyJoiner extends CategoryJoiner {
    	function getTaxonomy(){
    		return $this->param('taxonomy','custom-taxonomy');
    	}
    }

    Step 2: Locate the getClasses method on the 'wp-custom-fields-search.php' and add this to the joiner array

    ....code before......
    function getClasses($type){
    	global $CustomSearchFieldStatic;
    	if(!$CustomSearchFieldStatic['Types']){
    		$CustomSearchFieldStatic['Types'] = array(
    			"joiner"=>array(
    				"PostDataJoiner" =>__( "Post Field",'wp-custom-fields-search'),
    				"CustomFieldJoiner" =>__( "Custom Field",'wp-custom-fields-search'),
    				"CategoryJoiner" =>__( "Category",'wp-custom-fields-search'),
    				"TagJoiner" =>__( "Tag",'wp-custom-fields-search'),
    				"CustomTaxonomyJoiner" =>__( "Custom Taxonomy",'wp-custom-fields-search'),
    				"PostTypeJoiner" =>__( "Post Type",'wp-custom-fields-search'),
    			),
    ...code after

    NB: Note that has been added to the array.
    Doing this will add Custom Taxonomy to the Data Types in the Admin. it worked for me and I hope this Helps you.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.