You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/the-basics/post-types.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,23 @@ sidebar_position: 4
9
9
Typically in WordPress when you're querying posts you get [`WP_Post`](https://codex.wordpress.org/Class_Reference/WP_Post) objects back. Timber have taken this a step further and return a `Timber/Post` object instead. This [has a ton of great helper methods and properties](https://timber.github.io/docs/reference/timber-post/) which makes it easier and more expressive to use.
Lumberjack has its own Post object which makes it easier and more expressive to run queries.
16
+
:::info Note on Timber v2
17
+
Timber v2 deprecated direct instantiation in favour of the `Timber::get_post()` factory implementation. When you call `get_post()`, Timber uses the Class Map to return the correct class for that post.
18
+
19
+
**Lumberjack automatically registers your custom post types with the Timber Class Map**
20
+
21
+
See: [Timber: Class Maps](https://timber.github.io/docs/v2/guides/class-maps/#the-post-class-map)
22
+
:::
23
+
24
+
Lumberjack post types provide a static `query` method to make this simpler.
19
25
20
26
```php
21
27
use Rareloop\Lumberjack\Post;
22
28
23
-
$post = new Post(1);
24
29
$collection = Post::query($wpQueryArray);
25
30
```
26
31
@@ -29,7 +34,6 @@ This becomes especially powerful when you start registering **Custom Post Types*
Copy file name to clipboardExpand all lines: versioned_docs/version-v7/the-basics/post-types.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,23 @@ sidebar_position: 4
9
9
Typically in WordPress when you're querying posts you get [`WP_Post`](https://codex.wordpress.org/Class_Reference/WP_Post) objects back. Timber have taken this a step further and return a `Timber/Post` object instead. This [has a ton of great helper methods and properties](https://timber.github.io/docs/reference/timber-post/) which makes it easier and more expressive to use.
Lumberjack has its own Post object which makes it easier and more expressive to run queries.
16
+
:::info Note on Timber v2
17
+
Timber v2 deprecated direct instantiation in favour of the `Timber::get_post()` factory implementation. When you call `get_post()`, Timber uses the Class Map to return the correct class for that post.
18
+
19
+
**Lumberjack automatically registers your custom post types with the Timber Class Map**
20
+
21
+
See: [Timber: Class Maps](https://timber.github.io/docs/v2/guides/class-maps/#the-post-class-map)
22
+
:::
23
+
24
+
Lumberjack post types provide a static `query` method to make this simpler.
19
25
20
26
```php
21
27
use Rareloop\Lumberjack\Post;
22
28
23
-
$post = new Post(1);
24
29
$collection = Post::query($wpQueryArray);
25
30
```
26
31
@@ -29,7 +34,6 @@ This becomes especially powerful when you start registering **Custom Post Types*
Copy file name to clipboardExpand all lines: versioned_docs/version-v8/the-basics/post-types.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,23 @@ sidebar_position: 4
9
9
Typically in WordPress when you're querying posts you get [`WP_Post`](https://codex.wordpress.org/Class_Reference/WP_Post) objects back. Timber have taken this a step further and return a `Timber/Post` object instead. This [has a ton of great helper methods and properties](https://timber.github.io/docs/reference/timber-post/) which makes it easier and more expressive to use.
Lumberjack has its own Post object which makes it easier and more expressive to run queries.
16
+
:::info Note on Timber v2
17
+
Timber v2 deprecated direct instantiation in favour of the `Timber::get_post()` factory implementation. When you call `get_post()`, Timber uses the Class Map to return the correct class for that post.
18
+
19
+
**Lumberjack automatically registers your custom post types with the Timber Class Map**
20
+
21
+
See: [Timber: Class Maps](https://timber.github.io/docs/v2/guides/class-maps/#the-post-class-map)
22
+
:::
23
+
24
+
Lumberjack post types provide a static `query` method to make this simpler.
19
25
20
26
```php
21
27
use Rareloop\Lumberjack\Post;
22
28
23
-
$post = new Post(1);
24
29
$collection = Post::query($wpQueryArray);
25
30
```
26
31
@@ -29,7 +34,6 @@ This becomes especially powerful when you start registering **Custom Post Types*
0 commit comments