Function
Add TML data to the query.
tml_the_posts( array $posts, WP_Query $wp_query )
Parameters
-
$postsarray - The posts.
-
$wp_queryWP_Query - The query object.
Return
array
The posts.
Source
function tml_the_posts( $posts, $wp_query ) {
// Bail if not in the main loop
if ( ! $wp_query->is_main_query() ) {
return $posts;
}
// Bail if not a TML action
if ( ! $wp_query->is_tml_action ) {
return $posts;
}
$post = tml_action_has_page();
if ( ! $post ) {
// Fake a post
$post = array(
'ID' => 0,
'post_type' => 'page',
'post_content' => sprintf( '[theme-my-login action="%s"]', tml_get_action()->get_name() ),
'post_title' => tml_get_action_title(),
'post_name' => tml_get_action_slug(),
'ping_status' => 'closed',
'comment_status' => 'closed',
'filter' => 'raw',
);
$post = new WP_Post( (object) $post );
}
return array( $post );
}
Uses
Changelog
| Version | Description |
|---|---|
| 7.0 | Introduced. |