Skip to content

Commit

Permalink
Fix param order and function name
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Dec 2, 2024
1 parent d4f57f4 commit 377d59c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,10 @@ The `getServerState()` function returns a read-only reactive object. This means
Let's consider a quiz that has multiple questions. Each question is a separate page. When the user navigates to a new question, the server provides the new question and the time left to answer all the questions.

```php
<div <?php echo wp_interactivity_state( 'myPlugin', array(
<div <?php echo wp_interactivity_data_wp_context( array(
'question' => get_question_for_page( get_the_ID() ),
'timeLeft' => 5 * 60, // Time to answer all the questions.
) ); ?>>
), 'myPlugin' ); ?>>
```

```javascript
Expand Down Expand Up @@ -794,9 +794,9 @@ The `getServerContext()` function returns a read-only reactive object. This mean
Consider a quiz that has multiple questions. Each question is a separate page. When the user navigates to a new question, the server provides the new question and the time left to answer all the questions.

```php
<div <?php echo wp_interactivity_data_wp_context( 'myPlugin', array(
<div <?php echo wp_interactivity_data_wp_context( array(
'currentQuestion' => get_question_for_page( get_the_ID() ),
) ); ?>>
), 'myPlugin' ); ?>>
```

```javascript
Expand Down

0 comments on commit 377d59c

Please sign in to comment.