Last active
January 22, 2017 19:24
This file contains 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 | |
/** | |
* Set Jetpack Publicize Default Message | |
* | |
* @package SetJetpackPublicizeDefaultMessage | |
* @author Bernhard Kau | |
* @license GPLv3 | |
* | |
* @wordpress-plugin | |
* Plugin Name: Set Jetpack Publicize Default Message | |
* Plugin URI: https://kau-boys.com | |
* Description: Sets the default sharing message | |
* Version: 0.1 | |
* Author: Bernhard Kau | |
* Author URI: https://kau-boys.com | |
* Text Domain: set-jetpack-publicize-default-message | |
*/ | |
/** | |
* Save a post metadata for a default sharing title if none is set. | |
*/ | |
function set_jetpack_publicize_default_message() { | |
global $post; | |
if ( ! empty( $post->ID ) ) { | |
if ( ! $wpas_title = get_post_meta( $post->ID, '_wpas_mess', true ) ) { | |
/* translators: %s: the name of the blog */ | |
$custom_message = sprintf( | |
__( 'Check out this new awesome blog post on %s!', 'set-jetpack-publicize-default-message' ), | |
get_bloginfo( 'name' ) | |
); | |
update_post_meta( $post->ID, '_wpas_mess', $custom_message ); | |
} | |
} | |
} | |
add_action( 'post_submitbox_misc_actions', 'set_jetpack_publicize_default_message' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment