Noptin_New_Post_Notify::get_post_merge_tags( WP_Post $post )
Retrieves merge tags for a given post.
Parameters Parameters
- $post
(WP_Post) (Required)
Source Source
File: includes/class-noptin-new-post-notify.php
protected function get_post_merge_tags( $post ) { if ( empty( $post ) ) { return array(); } $tags = $post->filter( 'display' )->to_array(); // Prevent wp_rss_aggregator from appending the feed name to excerpts. $wp_rss_aggregator_fix = has_filter( 'get_the_excerpt', 'mdwp_MarkdownPost' ); if ( false !== $wp_rss_aggregator_fix ) { remove_filter( 'get_the_excerpt', 'mdwp_MarkdownPost', $wp_rss_aggregator_fix ); } add_filter( 'excerpt_more', array( $this, 'excerpt_more' ), 100000 ); $tags['post_excerpt'] = get_the_excerpt( $post->ID ); remove_filter( 'excerpt_more', array( $this, 'excerpt_more' ), 100000 ); if ( false !== $wp_rss_aggregator_fix ) { add_filter( 'get_the_excerpt', 'mdwp_MarkdownPost', $wp_rss_aggregator_fix ); } $tags['excerpt'] = $tags['post_excerpt']; $tags['post_content'] = apply_filters( 'the_content', $post->post_content ); $tags['content'] = $tags['post_content']; $tags['post_title'] = get_the_title( $post->ID); $tags['title'] = $tags['post_title']; $tags['featured_image'] = get_the_post_thumbnail(); $author = get_userdata( $tags['post_author'] ); // Author details. $tags['post_author'] = $author->display_name; $tags['post_author_email'] = $author->user_email; $tags['post_author_login'] = $author->user_login; $tags['post_author_id'] = $author->ID; // Date. $tags['post_date'] = get_the_date( '', $post->ID ); // Link. $tags['post_url'] = get_the_permalink( $post->ID ); unset( $tags['ID'] ); $tags['post_id'] = $post->ID; // Read more button. $tags['read_more_button'] = $this->read_more_button( $tags['post_url'] ); $tags['/read_more_button'] = '</a></div>'; return $tags; }
Expand full source code Collapse full source code View on GitHub