Last active
June 17, 2019 11:27
-
-
Save n7studios/cefdf12f38abe8f854341c84c907e2b5 to your computer and use it in GitHub Desktop.
WordPress to Buffer: Modify Excerpt in Status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WP to Buffer: Modify Excerpt in Status | |
* Plugin URI: http://www.wpzinc.com/ | |
* Version: 0.0.1 | |
* Author: WP Zinc | |
* Author URI: http://www.wpzinc.com | |
* Description: Modify the {excerpt} output, immediately before it is sent to Buffer. | |
*/ | |
/** | |
* Modifies the Post Excerpt generated from using the {excerpt} status tag, | |
* immediately before the status is sent to Buffer. | |
* | |
* @since 0.0.1 | |
* | |
* @param string $excerpt Post Excerpt | |
* @param WP_Post $post WordPress Post | |
* @return string Post Excerpt | |
*/ | |
function wp_to_buffer_publish_modify_excerpt( $excerpt, $post ) { | |
// Return full excerpt | |
return $post->post_excerpt; | |
} | |
// Filter for Free version of Plugin | |
add_filter( 'wp_to_buffer_publish_get_excerpt', 'wp_to_buffer_publish_modify_excerpt', 10, 2 ); | |
// Filter for Pro version of Plugin | |
add_filter( 'wp_to_buffer_pro_publish_get_excerpt', 'wp_to_buffer_publish_modify_excerpt', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment