Modify Nonprofit custom fields.
add_filter(
'goodbids_nonprofit_custom_fields',
function( array $fields ) : array {
$fields['key'] = [
'label' => __( 'Custom Field', 'goodbids' ),
'type' => 'text',
'required' => false,
'default' => '',
'placeholder' => '',
];
return $fields;
}
);
Modify the new bid product associated with a product.
add_filter(
'goodbids_bid_product',
function( WC_Product_Simple $bid_product, int $post_id ) : WC_Product_Simple {
$bid_product->set_regular_price( 2 );
return $bid_product;
}
);
Modifies the classes for custom blocks.
add_filter(
'goodbids_block_class',
function( array $class, array $block ) : array {
$class[] = 'my-custom-class';
return $class;
},
10,
2
);
Adds support for additional custom block directories.
add_filter(
'goodbids_block_locations',
function( array $locations ) : array {
$locations[] = get_stylesheet_directory() . '/blocks';
return $locations;
}
);
Registers custom block patterns.
add_filter(
'goodbids_block_patterns',
function ( array $patterns ): array {
$theme_patterns = [
[
'name' => 'goodbids-np/my-pattern',
'path' => get_stylesheet_directory() . '/patterns/my-pattern.php',
'title' => __( 'My Pattern', 'goodbids-nonprofit' ),
'source' => 'theme',
'inserter' => true,
]
];
return array_merge( $patterns, $theme_patterns );
}
);
Allows Auction Settings to be overridden.
add_filter(
'goodbids_auction_setting',
function ( mixed $value, string $meta_key, int $auction_id ): array {
if ( 'my-custom-key' !== $meta_key ) {
return $value;
}
$value = 'my-custom-value';
return $value;
},
10,
3
);
Customizes the default block template for new Auctions.
add_filter(
'goodbids_auction_block_template',
function ( mixed $template, int $auction_id ): array {
$template[] = [
'core/paragraph',
[
'placeholder' => __( 'Custom Placeholder', 'text-domain' ),
],
];
return $template;
},
10,
2
);
Allows the template view paths to be overridden.
add_filter(
'goodbids_view_path',
function( string $path, string $name ) : string {
return get_stylesheet_directory() . '/my-custom-path/' . $name;
},
10,
2
);