Skip to content

Commit

Permalink
Filter Events: Add docs for using in raw post content.
Browse files Browse the repository at this point in the history
  • Loading branch information
iandunn committed Nov 8, 2023
1 parent 6c43f89 commit 6bfa569
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions mu-plugins/blocks/google-map-event-filters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ It uses the `wporg/google-map` block to display a searchable list and/or map of
<!-- wp:wporg/google-map-event-filters <?php echo wp_json_encode( $filter_options ); ?> /-->
```

Alternatively, you could take that JSON and manually put it in the post source like this:

```html
<!-- wp:wporg/google-map-event-filters {"filterSlug":"wp20","startDate":"April 21, 2023","endDate":"May 30, 2023","googleMapBlockAttributes":{"id":"wp20","apiKey":"WORDCAMP_DEV_GOOGLE_MAPS_API_KEY"}} /-->
```

1. View the page where the block is used. That will create the cron job that updates the data automatically in the future.
1. Run `wp cron event run prime_event_filters` to test the filtering. Look at each title, and add any false positives to `$false_positives` in `filter_potential_events()`. If any events that should be included were ignored, add a keyword from the title to `$keywords`. Run the command after those changes and make sure it's correct now.
2 changes: 1 addition & 1 deletion mu-plugins/blocks/google-map-event-filters/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Edit() {
return (
<Placeholder
instructions={ __(
'This is a placeholder for the editor. Data is supplied to this block via the pattern that includes it.',
'This is a placeholder for the editor until a back-end UI is built. See the README for instructions on supplying data.',
'wporg'
) }
label={ __( 'Google Map Event Filters', 'wporg' ) }
Expand Down
4 changes: 2 additions & 2 deletions mu-plugins/blocks/google-map/src/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export default function Main( {
behavior: 'smooth',
} );

// This is passing the value directly, instead of using, state because the throttled function only has
// access to the versionof state that existed at the time the function was created. Updating the
// This is passing the value directly, instead of using state, because the throttled function only has
// access to the version of state that existed at the time the function was created. Updating the
// function with something like `useCallback` is more complicated than you'd think.
throttledRedrawMap( event.target.value );
}, [] );
Expand Down

0 comments on commit 6bfa569

Please sign in to comment.