This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_slug_skip_post( $skip, $post ) { | |
if( $post->post_type == 'resource' ) { | |
if (has_term('Thank You', 'resource-category', $post ) || has_term('Thank You', 'resource-tag', $post ) ) { | |
$skip = true; | |
} | |
} | |
return $skip; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cm_typesense_format_resource_category_data ( $formatted_data, $raw_data, $object_id, $schema_name ) { | |
if ( $schema_name == 'resource' ) { | |
$terms = get_the_terms( $object_id, 'resource-category' ); | |
$resource_categories = []; | |
foreach ( $terms as $term ) { | |
// Hide the "Thank you" category. | |
// skip "Thank You" category from being indexed | |
if( $term->name != 'Thank You' ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add sex variation to the schema | |
add_filter( 'cm_tsfwc_product_fields', 'your_slug_add_stock_status_to_schema' ); | |
function your_slug_add_stock_status_to_schema( $product_fields ) { | |
$product_fields[] = [ 'name' => 'sex_variation', 'type' => 'string[]', 'facet' => true ]; | |
return $product_fields; | |
} | |
// Data entry for sex_variation for indexing | |
add_filter( 'cm_tsfwc_data_before_entry', 'your_slug_add_data_before_entry', 10, 4 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cm_typesense_schema', 'add_schema', 10, 2 ); | |
function add_schema( $schema, $name ) { | |
if ( $name === 'cpt_1' || $name = 'cpt_2' ) { | |
$schema['name'] = 'cpts-data'; | |
$schema['fields] = [ | |
[ 'name' => 'field_1', 'type' => 'string' ], | |
[ 'name' => 'field_2', 'type' => 'string' ], | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cm_tsfwc_product_fields', 'your_slug_add_stock_status_to_schema' ); | |
function your_slug_add_stock_status_to_schema( $product_fields ) { | |
$product_fields[] = [ 'name' => 'stock_status', 'type' => 'string' ]; | |
return $product_fields; | |
} | |
add_filter( 'cm_tsfwc_data_before_entry', 'your_slug_add_data_before_entry', 10, 4 ); | |
function your_slug_add_data_before_entry( $formatted_data, $raw_data, $object_id, $schema_name ) { | |
if( $schema_name === 'product' ) { // only add data if the schema is product | |
$stock_status = $raw_data->get_stock_status(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Step 1 | |
// Adding the ACF field to schema to be indexed | |
function cm_typesense_add_acf_field_to_schema( $schema, $name ) { | |
if ( $name == 'post' ) { // change post to your schema name | |
$schema['fields'][] = [ 'name' => 'acf_field', 'type' => 'string' ]; // | |
} | |
return $schema; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cm_typesense_add_available_post_types( $available_post_types ) { | |
$available_post_types['job_listing'] = [ 'label' => 'job_listing', 'value' => 'job_listing' ]; | |
return $available_post_types; | |
} | |
add_filter( 'cm_typesense_available_index_types', 'cm_typesense_add_available_post_types'); | |
//only necessary if the default post schema is not necessary | |
function cm_typesense_add_job_listing_schema( $schema, $name ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cm_typesense_schema', 'your_slug_add_tags', 10, 2 ); | |
function your_slug_add_tags( $schema, $name ) { | |
if( 'post' === $name ) { | |
$schema['fields'][] = [ 'name' => 'tags', 'type' => 'string[]', 'facet' => true ]; | |
} | |
return $schema; | |
} | |
add_filter( 'cm_typesense_data_before_entry', 'your_slug_tags_data', 10, 4 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tmpl_hook_obj = Codemanas\Typesense\WooCommerce\Main\TemplateHooks::get_instance(); | |
remove_action( 'cm_tsfwc_filter_panel_output', [ $tmpl_hook_obj, 'category_filter' ], 5 ); //This must be 5 | |
add_action( 'cm_tsfwc_filter_panel_output', [ $tmpl_hook_obj, 'category_filter'], 18 ); // You can change the priority as per your requirement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps: | |
Copy to .devilbox files like apache22.yml and nginx.yml as per docs. | |
When subdomain is added. Add them to /etc/hosts too | |
Detailed step | |
1. Create `.devilbox` folder inside the project at `htdocs` level. | |
2. Copy related ngnix/apache file from `cfg/vhost-gen` folder | |
3. Once copied rename it to `.nginx` or `.apapche` | |
4. Then change the code as mentioned in the docs |