Skip to content

Commit

Permalink
Merge pull request #164 from devgeniem/TMS-1075
Browse files Browse the repository at this point in the history
TMS-1075: Redipress 2 filters
  • Loading branch information
eebbi authored Oct 23, 2024
2 parents 469d022 + 3f6855a commit c426557
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-1075: Redipress 2 filters

## [1.18.9] - 2024-09-25

- TMS-1067: Show price-info for event in listing if it's free
Expand Down
16 changes: 8 additions & 8 deletions lib/PostType/Artwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ public function __construct() {
* @return void
*/
public function hooks() : void {
add_action( 'init', Closure::fromCallable( [ $this, 'register' ] ), 15 );
add_filter( 'tms/gutenberg/blocks', Closure::fromCallable( [ $this, 'allowed_blocks' ] ), 10, 1 );
\add_action( 'init', Closure::fromCallable( [ $this, 'register' ] ), 15 );
\add_filter( 'tms/gutenberg/blocks', Closure::fromCallable( [ $this, 'allowed_blocks' ] ), 10, 1 );

add_filter(
\add_filter(
'tms/base/breadcrumbs/before_prepare',
Closure::fromCallable( [ $this, 'format_single_breadcrumbs' ] ),
10,
3
);

add_filter(
\add_filter(
'tms/base/breadcrumbs/after_prepare',
Closure::fromCallable( [ $this, 'format_archive_breadcrumbs' ] ),
);

add_filter( 'redipress/schema_fields', function ( $fields ) {
\add_filter( 'redipress/index/posts/schema_fields', function ( $fields ) {
foreach ( $fields as $schema_field ) {
// Bail out if artists key already exists in schema
if ( $schema_field->name === 'artists' ) {
Expand All @@ -94,15 +94,15 @@ public function hooks() : void {
return $fields;
}, PHP_INT_MAX, 1 );

add_filter( 'redipress/additional_field/artists', function ( $value, $post_id, $post ) {
\add_filter( 'redipress/additional_field/artists', function ( $value, $post_id, $post ) {
if ( $post->post_type === Artwork::SLUG ) {
$value = get_post_meta( $post_id, 'artists', true );
$value = \get_post_meta( $post_id, 'artists', true );
}

return $value;
}, 10, 3 );

add_filter( 'redipress/search_fields', function ( $fields ) {
\add_filter( 'redipress/search_fields', function ( $fields ) {
if ( ! in_array( 'artists', $fields, true ) ) {
$fields[] = 'artists';
}
Expand Down

0 comments on commit c426557

Please sign in to comment.