Skip to content

Commit

Permalink
Events: Add event limit to event-list block. (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne authored Dec 7, 2023
1 parent 64188bf commit 43a2deb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"events": {
"type": "string",
"default": "all-upcoming"
},
"limit": {
"type": "number",
"default": 100
}
},
"supports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function render( $attributes, $content, $block ) {
schedule_filter_cron( $attributes['events'], 0, 0, $facets );

// Get all the filters that are currently applied.
$filtered_events = array_slice( filter_events( $events ), 0, 10);
$filtered_events = array_slice( filter_events( $events ), 0, (int) $attributes['limit'] );

// Group events by month year.
$grouped_events = array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- /wp:group -->

<!-- wp:pattern {"slug":"wporg-events-2023/event-list-filters"} /-->
<!-- wp:wporg/event-list /-->
<!-- wp:wporg/event-list {"limit": "500"} /-->
</div>
<!-- /wp:group -->
</main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
style="padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--edge-space)">

<!-- wp:pattern {"slug":"wporg-events-2023/event-list-filters"} /-->
<!-- wp:wporg/event-list /-->
<!-- wp:wporg/event-list {"limit": "500"} /-->
</div>
<!-- /wp:group -->
</main>
Expand Down

0 comments on commit 43a2deb

Please sign in to comment.