\TimberStream

TimberStream

Summary

Methods
Properties
Constants
__construct()
get_posts()
get_posts_without_tax_query()
filter_stream()
repopulate_stream()
check_post()
remove_post()
insert_post()
remove_pinned()
reinsert_pinned()
get()
set()
save_stream()
$posts
$sm_query
$default_options
$options
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$posts

$posts : array

Stream post cache.

This will only be populated when TimberStream::get_posts is run without a $query argument.

Type

array

$sm_query

$sm_query : array

Type

array

$default_options

$default_options : array

Default stream options, used when creating a new stream.

Type

array

$options

$options : array

Stream options.

This is set by __construct based on what is stored in the database.

Type

array

Methods

__construct()

__construct(integer|boolean|string  $pid = null) 

Init Stream object

Parameters

integer|boolean|string $pid

Post ID or slug

get_posts()

get_posts(array  $query = array(), string  $PostClass = 'TimberPost') : array

Get filtered & sorted collection of posts in the stream

Parameters

array $query

WP_Query query argument

string $PostClass

Timber post class

Returns

array —

collection of TimberPost objects

get_posts_without_tax_query()

get_posts_without_tax_query(  $query,   $PostClass = 'TimberPost') 

Get the ids of all saved posts, including any removed by the taxonomy query

Parameters

$query
$PostClass

filter_stream()

filter_stream(  $attribute,   $value) : array

Filter posts in the stream, returning only the filtered posts (including their position).

Parameters

$attribute
$value

Returns

array —

filtered posts

repopulate_stream()

repopulate_stream() 

Enforce the stream length.

If there are fewer posts than allowed, add some from the base query. If there are more, remove them.

check_post()

check_post(integer  $post_id) : array

Checks if a post exists in a stream

Parameters

integer $post_id

Post ID

Returns

array —

returns the data saved in the stream, plus its position

remove_post()

remove_post(integer  $post_id, boolean  $repopulate = true) 

Removes a post from a stream and, by default, fills in the empty space at the end.

Parameters

integer $post_id

Post ID

boolean $repopulate

add/remove posts to enforce stream length

insert_post()

insert_post(integer  $post_id) 

Inserts a post in the stream

Parameters

integer $post_id

Post ID

remove_pinned()

remove_pinned() 

Temporarily removes pinned items from the stream, for the purpose of modifying the auto-flowing stream.

reinsert_pinned()

reinsert_pinned() 

Place the pinned items back in the stream in their appropriate locations

get()

get(  $key) 

Parameters

$key

set()

set(  $key,   $value) 

Parameters

$key
$value

save_stream()

save_stream() 

Save the stream metadata