Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Apr 25, 2022
1 parent 200f133 commit a1a7387
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ Note that you need to add `data-sophi-feature=<widget_name>` to the wrapper div
```

#### Caveats
While the above query integration works just fine, it has been observed that on VIP infrastructures, `WP_Query` returns latest posts instead of the posts curated by Sophi. A workaround for this is to use [get_posts](https://developer.wordpress.org/reference/functions/get_posts/) instead.
While the above query integration works just fine, it has been observed that on VIP infrastructures, `WP_Query` returns latest posts instead of the posts curated by Sophi. A workaround for this is to use [get_posts](https://developer.wordpress.org/reference/functions/get_posts/) instead. Also remember to whitelist `get_posts` by adding the following inline comment so that PHPCS doesn't throw a warning:
`phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts`

In addition to using `get_posts`, it would be good practice to add a comment explaining the usage of it so that developers new to it don't swap it for `WP_Query`.

### Post content type

Expand Down
6 changes: 6 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ Note that you need to add `data-sophi-feature=<widget_name>` to the wrapper div
</div>
`

== Caveats ==
While the above query integration works just fine, it has been observed that on VIP infrastructures, `WP_Query` returns latest posts instead of the posts curated by Sophi. A workaround for this is to use [get_posts](https://developer.wordpress.org/reference/functions/get_posts/) instead. Also remember to whitelist `get_posts` by adding the following inline comment so that PHPCS doesn't throw a warning:
`phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts`

In addition to using `get_posts`, it would be good practice to add a comment explaining the usage of it so that developers new to it don't swap it for `WP_Query`.

= Post content type =

By default, Sophi for WordPress uses post format as the content type. This plugin uses `content_type` internally to distinguish between WordPress post type and Sophi type.
Expand Down

0 comments on commit a1a7387

Please sign in to comment.