Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
Last active January 22, 2017 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2ndkauboy/bc5ed4b73f1cb345d42f48a5561b7c4b to your computer and use it in GitHub Desktop.
Save 2ndkauboy/bc5ed4b73f1cb345d42f48a5561b7c4b to your computer and use it in GitHub Desktop.
<?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