Created
June 29, 2018 14:16
-
-
Save bacalj/bb173787b5f5299ae4c60189a214da19 to your computer and use it in GitHub Desktop.
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: Post Edit Reminder | |
Description: Allows admin to add a customizable post-it-like reminder to Post Edit screen. Requires Advanced Custom Fields | |
Author: Joe Bacal | |
Version: 0.1 | |
*/ | |
function postreminder_text_after_title( $post_type ) { | |
$message = get_field('post_reminder_text', 'option'); | |
?> | |
<div class="after-title-help postbox" style="width:50%; padding:10px; border-radius:6px; background-color:#fefece;"> | |
<?php echo $message; ?> | |
</div><!-- .postbox --> | |
<?php } | |
add_action( 'edit_form_after_title', 'postreminder_text_after_title' ); | |
//create the options page via acf | |
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(array( | |
'page_title' => 'post-reminder-edit', | |
'menu_title' => 'Post Reminder Edit', | |
'menu_slug' => 'post-reminder-edit', | |
'capability' => 'activate_plugins', | |
'redirect' => false | |
)); | |
} | |
//local acf field group | |
if( function_exists('acf_add_local_field_group') ): | |
acf_add_local_field_group(array ( | |
'key' => 'group_5887a22b3c8b2', | |
'title' => 'Post Reminder Text', | |
'fields' => array ( | |
array ( | |
'tabs' => 'all', | |
'toolbar' => 'full', | |
'media_upload' => 1, | |
'default_value' => '', | |
'delay' => 0, | |
'key' => 'field_5887a23639b61', | |
'label' => 'Post Reminder Text', | |
'name' => 'post_reminder_text', | |
'type' => 'wysiwyg', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => array ( | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
), | |
), | |
), | |
'location' => array ( | |
array ( | |
array ( | |
'param' => 'options_page', | |
'operator' => '==', | |
'value' => 'post-reminder-edit', | |
), | |
), | |
), | |
'menu_order' => 0, | |
'position' => 'normal', | |
'style' => 'default', | |
'label_placement' => 'top', | |
'instruction_placement' => 'label', | |
'hide_on_screen' => '', | |
'active' => 1, | |
'description' => '', | |
)); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment