{
$this->pluginDirName = $path;
add_action('init', array($this, 'addPostTypes'));
+ add_filter('post_updated_messages', array($this, 'blocksUpdatedMessages'));
add_action('admin_enqueue_scripts', array($this, 'load_admin_scripts'));
add_action('add_meta_boxes', array($this, 'addMetaBoxes'));
add_action('save_post', array($this, 'saveMetaBox'));
*/
public function sortQuery($query)
{
- if (is_admin() && !isset($_REQUEST['orderby'])) {
+ if ( is_admin()
+ && !isset($_REQUEST['orderby'])
+ && isset($query)
+ && is_object($query)
+ && isset($query->query['post_type'])) {
$postType = $query->query['post_type'];
if ($postType == GLM_BLOCK_POST_TYPE) {
$query->set('orderby', 'menu_order');
include $this->pluginDirName . 'views/front/showBlocks.php';
}
+ /**
+ * Update the message text for the block post type
+ *
+ * @global type $post Post object
+ * @global type $post_ID Id of post
+ *
+ * @param type $messages Messages array
+ *
+ * @return type
+ */
+ public function blocksUpdatedMessages($messages)
+ {
+ global $post, $post_ID;
+
+ $messages['glm_blocks'] = array(
+ 0 => '', // Unused. Messages start at index 1.
+ 1 => sprintf(__('Block updated. <a href="%s">View item</a>'),
+ esc_url(get_permalink($post_ID))),
+ 2 => __('Custom field updated.'),
+ 3 => __('Custom field deleted.'),
+ 4 => __('Block updated.'),
+ /* translators: %s: date and time of the revision */
+ 5 => isset($_GET['revision'])
+ ? sprintf(__('Block restored to revision from %s'),
+ wp_post_revision_title((int) $_GET['revision'],
+ false))
+ : false,
+ 6 => sprintf(__('Block published. <a href="%s">View event</a>'),
+ esc_url(get_permalink($post_ID))),
+ 7 => __('Block saved.'),
+ 8 => sprintf(__('Block submitted. <a target="_blank" href="%s">Preview event</a>'),
+ esc_url(add_query_arg('preview', 'true',
+ get_permalink($post_ID)))),
+ 9 => sprintf(__('Block scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview job</a>'),
+ // translators: Publish box date format, see http://php.net/date
+ date_i18n(__('M j, Y @ G:i'),
+ strtotime($post->post_date)),
+ esc_url(get_permalink($post_ID))),
+ 10 => sprintf(__('Block draft updated. <a target="_blank" href="%s">Preview event</a>'),
+ esc_url(add_query_arg('preview', 'true',
+ get_permalink($post_ID)))),
+ );
+ return $messages;
+ }
/**
* addOrderColumn
*