3ev Core Wordpress library API
  • Namespace
  • Class

Namespaces

  • Tev
    • Application
      • Bootstrap
    • Author
      • Model
    • Contracts
    • Database
      • CustomTables
    • Field
      • Model
      • Util
    • Plugin
      • Action
      • Shortcode
    • Post
      • Model
      • Repository
    • Taxonomy
      • Model
      • Repository
    • Term
      • Model
      • Repository
    • Util
    • View
      • Exception
  • None

Classes

  • AbstractPost
  • Attachment
  • Page
  • Post

Class AbstractPost

Abstract post entity class.

Provides a nicely object-oriented interface to a Wordpress post.

Tev\Post\Model\AbstractPost implements Tev\Contracts\WordpressWrapperInterface

Direct known subclasses

Tev\Post\Model\Attachment, Tev\Post\Model\Page, Tev\Post\Model\Post

Abstract
Namespace: Tev\Post\Model
Located at Tev/Post/Model/AbstractPost.php

Methods summary

public
# __construct( WP_Post $base, Tev\Author\Factory $authorFactory, Tev\Taxonomy\Factory $taxonomyFactory, Tev\Field\Factory $fieldFactory, Tev\Post\Factory $postFactory )

Constructor.

Constructor.

Inject dependencies.

Parameters

$base
Base Wordpress post
$authorFactory
Author factory
$taxonomyFactory
Taxonomy entity factory
$fieldFactory
Field entity factory
$postFactory
Post entity factory
public integer
# getId( )

Get the post ID.

Get the post ID.

Returns

integer
public string
# getType( )

Get the post type.

Get the post type.

Returns

string
public string
# getTypeName( )

Get the singular name for the post type of this post.

Get the singular name for the post type of this post.

Returns

string
public stdClass
# getTypeLabels( )

Get the post type labels for this post.

Get the post type labels for this post.

See:

http://codex.wordpress.org/Function_Reference/get_post_type_object

for the list of labels returned.

Returns

stdClass
public string
# getName( )

Get the post slug.

Get the post slug.

Returns

string
public string
# getStatus( )

Get the post status. One of:

Get the post status. One of:

  • publish
  • pending
  • draft
  • auto-draft
  • future
  • private
  • inherit
  • trash

Returns

string
public string
# getTitle( )

Get the post title.

Get the post title.

Returns

string
public string
# getContent( )

Get the post content, formatted as HTML.

Get the post content, formatted as HTML.

Returns

string
public string
# getRawContent( )

Get the raw post content.

Get the raw post content.

Returns

string
public boolean
# hasExcerpt( )

Check if this post has a manually set excerpt.

Check if this post has a manually set excerpt.

Returns

boolean
True if has excerpt, false if not
public string
# getExcerpt( string|null $content = null )

Get the post excerpt.

Get the post excerpt.

Adapted from wp_trim_excerpt() in wp-includes/formatting.php.

Parameters

$content

Optional. Base content to use for excerpt if post excerpt isn't defined. Defaults to post content

Returns

string
public string
# getUrl( array $query = array() )

Get post URL.

Get post URL.

Parameters

$query
Query string args. Key value pairs

Returns

string
public Tev\Post\Model\Attachment|false
# getFeaturedImage( )

Get this Post's featured image.

Get this Post's featured image.

Returns

Tev\Post\Model\Attachment|false

Featured image object, or false if not set

public string|null
# getFeaturedImageUrl( mixed $size = 'thumbnail' )

Get Post featured image URL.

Get Post featured image URL.

Convenient alias for:

$pos->getFeaturedImage()->getImageUrl($size);

Parameters

$size
Arguments accepted by second param of wp_get_attachment_image_src()

Returns

string|null
Image URL, or null if no image set
public string
# getAuthorId( )

Get the post author ID.

Get the post author ID.

Returns

string
public Tev\Author\Model\Author
# getAuthor( )

Get post author.

Get post author.

Returns

Tev\Author\Model\Author
public integer|null
# getParentPostId( )

Get the parent post ID.

Get the parent post ID.

Returns

integer|null
Parent post ID or null if no parent
public Tev\Post\Model\AbstractPost|null
# getParent( )

Get the parent post, if set.

Get the parent post, if set.

Returns

Tev\Post\Model\AbstractPost|null
public Carbon\Carbon
# getPublishedDate( )

Get the post published date.

Get the post published date.

Returns

Carbon\Carbon
public Carbon\Carbon
# getPublishedDateGmt( )

Get the post published date in GMT.

Get the post published date in GMT.

Returns

Carbon\Carbon
public Carbon\Carbon
# getModifiedDate( )

Get the post modified date.

Get the post modified date.

Returns

Carbon\Carbon
public Carbon\Carbon
# getModifiedDateGmt( )

Get the post modified date in GMT.

Get the post modified date in GMT.

Returns

Carbon\Carbon
public Tev\Term\Model\Term[]
# getCategories( )

Get all categories for this post.

Get all categories for this post.

Returns

Tev\Term\Model\Term[]
Array of categories
public Tev\Term\Model\Term[]
# getTags( )

Get all tags for this post.

Get all tags for this post.

Returns

Tev\Term\Model\Term[]
Array of tags
public Tev\Term\Model\Term[]
# getTermsFor( mixed|Tev\Taxonomy\Model\Taxonomy $taxonomy )

Get all terms for this post in the given taxonomy.

Get all terms for this post in the given taxonomy.

Parameters

$taxonomy
Taxonomy name or object

Returns

Tev\Term\Model\Term[]
Array of terms
public mixed
# meta( string $key, boolean $single = true )

Get a meta value on this post.

Get a meta value on this post.

See: http://codex.wordpress.org/Function_Reference/get_post_meta for how $single works.

Parameters

$key
Meta item key
$single
Optional. Defaults to true

Returns

mixed
Meta data
public Tev\Field\Model\AbstractField
# field( string $name )

Get a custom field on this post.

Get a custom field on this post.

Parameters

$name
Field name (or key)

Returns

Tev\Field\Model\AbstractField
Field object
public WP_Post
# getBaseObject( )

Get the underlying WP_Post object.

Get the underlying WP_Post object.

Returns

WP_Post

Implementation of

Tev\Contracts\WordpressWrapperInterface::getBaseObject()
protected stdClass
# getPostTypeObject( )

Get the post type object for this post.

Get the post type object for this post.

Contains information about the post type of this post.

Returns

stdClass
3ev Core Wordpress library API API documentation generated by ApiGen