Download the PHP package elcontraption/wp-post-inspector without Composer
On this page you can find all versions of the php package elcontraption/wp-post-inspector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elcontraption/wp-post-inspector
More information about elcontraption/wp-post-inspector
Files in elcontraption/wp-post-inspector
Package wp-post-inspector
Short Description Tools for interacting and inspecting WordPress post objects.
License MIT
Informations about the package wp-post-inspector
WP Post Inspector
Tools for interacting and inspecting WordPress post objects.
- Installation
- Retrieving a post object
- Methods
- Accessing post attributes
- Traversing the post hierarchy
Installation
Install as a dependency of your theme via composer:
Retrieving a post object
Methods
ancestors
Returns array of ancestors as PostInspector objects.
descendants
Returns array of descendants as PostInspector objects.
parent
Access parent PostInspector object.
permalink
Shortcut for get_permalink($currentPost->id())
.
siblings
Returns array of siblings as PostInspector objects.
top
Access the top ancestor as a PostInspector object.
Accessing post attributes
You may either use standard WP_Post attributes (as methods) or any of the shortcut methods built in to this class.
Attribute name | Shortcut method |
---|---|
ID | id |
post_author | author |
post_date | date |
post_date_gmt | gmt or dateGmt |
post_content | content |
post_title | title |
post_excerpt | excerpt |
post_status | status |
comment_status | commentStatus |
ping_status | pingStatus |
post_password | password |
post_name | name or slug |
to_ping | toPing |
pinged | pinged |
post_modified | modified |
post_modified_gmt | modifiedGmt |
post_content_filtered | contentFiltered |
post_parent | parent |
guid | guid |
menu_order | menuOrder |
post_type | type |
post_mime_type | mimeType |
comment_count | commentCount |
filter | filter |
Traversing the post hierarchy
You may traverse the post hierarchy using the parent
, top
, ancestors
, descendants
, and siblings
methods: