Documentation
Documentation
Graphic_Data_Admin
in package
The admin-specific functionality of the plugin.
Defines the plugin name, version, and two examples hooks for how to enqueue the admin-specific stylesheet and JavaScript.
Table of Contents
Methods
- add_favicon() : mixed
- Change default favicon associated with site to Sanctuary Watch logo, if there is no site icon set in the theme.
- adjust_admin_post_time_display() : void
- Adjust admin post time display to show local timezone and author information.
- allow_svg_uploads() : array<string|int, mixed>
- Add SVG support to allowed upload MIME types.
- enqueue_bootstrap_admin() : mixed
- Enqueue Bootstrap (version 5.3.0) CSS and Javascript.
- enqueue_scripts() : mixed
- Register the JavaScript for the admin area.
- enqueue_styles() : mixed
- Register the stylesheets for the admin area.
- enqueue_tinymce_new_tab_script() : void
- Enqueues the TinyMCE new-tab default script and passes configuration data to it.
- hide_permalink() : mixed
- Remove permalink from edit post admin screens.
- modify_publish_button_text() : string
- Filters the text of the Publish and Update buttons to display "Save" instead.
- plugin_check_required_theme() : mixed
- Checks if the required theme ("Graphic Data Theme") is active.
- remove_admin_bar_options() : mixed
- Remove the ability to access Comments, Posts, Users, and Pages content types from the admin bar of the dashboard.
- remove_all_dates() : mixed
- Remove "All dates" filter from admin screens.
- remove_dashboard_widgets() : mixed
- Remove remove unwanted widgets from the WordPress dashboard.
- remove_elements_from_menu() : mixed
- Remove the ability to access the Comments, Posts, and Pages content types from the sidebar of the dashboard.
- remove_gutenberg() : mixed
- Remove "Thank you for creating with wordpress" from the lower left of the footer of admin screens.
- remove_header_row() : mixed
- Remove header row before fields for custom content types.
- remove_screen_options() : mixed
- Remove screen options metabox from edit post screens.
- remove_thank_you() : mixed
- Remove "Thank you for creating with wordpress" from the lower left of the footer of admin screens.
- remove_view_link_from_post_type() : mixed
- Remove "view" link from admin screen for instance, modal, and figure posts.
- restrict_content_editor_admin_menu() : mixed
- Edit what users with the Content Editor can see on the dashboard
- wppversionremove() : mixed
- Remove WordPress version number from appearing in the lower right of admin footer.
Methods
add_favicon()
Change default favicon associated with site to Sanctuary Watch logo, if there is no site icon set in the theme.
public
add_favicon() : mixed
Tags
adjust_admin_post_time_display()
Adjust admin post time display to show local timezone and author information.
public
adjust_admin_post_time_display() : void
Replaces the default WordPress timestamp display in the publish metabox with a custom format that shows the publication date/time in local timezone (converted from GMT), the author who published the post, and optionally the last modification details if the post has been updated.
Only applies to specific custom post types: instance, scene, modal, figure, and about. Uses jQuery to dynamically replace the #timestamp element content after DOM ready.
The function displays:
- Publication date/time in "F j, Y @ g:i A" format (e.g., "January 15, 2025 @ 3:45 PM")
- Author name (first + last name, or display name as fallback)
- Last modified date/time and modifier (if post has been updated and metadata exists)
Tags
Return values
void —Returns early if not on a post edit screen or if post type is not in the custom list.
allow_svg_uploads()
Add SVG support to allowed upload MIME types.
public
allow_svg_uploads(array<string|int, mixed> $mimes) : array<string|int, mixed>
Parameters
- $mimes : array<string|int, mixed>
-
Allowed MIME types.
Return values
array<string|int, mixed> —Modified MIME types with SVG support.
enqueue_bootstrap_admin()
Enqueue Bootstrap (version 5.3.0) CSS and Javascript.
public
enqueue_bootstrap_admin() : mixed
Tags
enqueue_scripts()
Register the JavaScript for the admin area.
public
enqueue_scripts(string $hook_suffix) : mixed
Enqueues utility scripts globally and conditionally loads post-type-specific scripts based on the current screen context. Scripts are loaded for:
- About, Instance, Scene, Modal, and Figure post types (edit/create screens)
- Modal and Figure admin column screens
- Figure Export Tool page
Parameters
- $hook_suffix : string
-
The current admin page hook suffix (e.g., 'post.php', 'edit.php').
Tags
enqueue_styles()
Register the stylesheets for the admin area.
public
enqueue_styles() : mixed
enqueue_tinymce_new_tab_script()
Enqueues the TinyMCE new-tab default script and passes configuration data to it.
public
enqueue_tinymce_new_tab_script(string $hook_suffix) : void
When the plugin setting links_new_tab_by_default is enabled, loads
admin-tinymce-new-tab.js on post-edit screens for any of the custom post
types that contain targeted TinyMCE fields (scene, modal, figure, about).
Configuration is passed to the script via wp_localize_script so that the
JavaScript knows which editor fields should default new links to opening in
a new tab.
To add a new field to the targeted list, append its TinyMCE editor ID to
the $target_fields array inside this method.
Parameters
- $hook_suffix : string
-
The current admin page hook suffix (e.g. 'post.php').
Tags
hide_permalink()
Remove permalink from edit post admin screens.
public
hide_permalink() : mixed
Tags
modify_publish_button_text()
Filters the text of the Publish and Update buttons to display "Save" instead.
public
modify_publish_button_text(string $translated_text, string $text, string $domain) : string
This function hooks into the gettext filter to modify the button text
in the WordPress post editor, changing "Publish" and "Update" to "Save".
Parameters
- $translated_text : string
-
The translated text that WordPress is about to output.
- $text : string
-
The original text string before translation.
- $domain : string
-
The text domain of the translation.
Tags
Return values
string —The modified button label if the original text is "Publish" or "Update", otherwise returns the original translated text.
plugin_check_required_theme()
Checks if the required theme ("Graphic Data Theme") is active.
public
plugin_check_required_theme() : mixed
If the required theme is not active, it displays an admin notice warning the user. This function is hooked to 'admin_notices'.
Tags
remove_admin_bar_options()
Remove the ability to access Comments, Posts, Users, and Pages content types from the admin bar of the dashboard.
public
remove_admin_bar_options() : mixed
Tags
remove_all_dates()
Remove "All dates" filter from admin screens.
public
remove_all_dates() : mixed
Tags
remove_dashboard_widgets()
Remove remove unwanted widgets from the WordPress dashboard.
public
remove_dashboard_widgets() : mixed
Tags
remove_elements_from_menu()
Remove the ability to access the Comments, Posts, and Pages content types from the sidebar of the dashboard.
public
remove_elements_from_menu() : mixed
Tags
remove_gutenberg()
Remove "Thank you for creating with wordpress" from the lower left of the footer of admin screens.
public
remove_gutenberg() : mixed
Tags
remove_header_row()
Remove header row before fields for custom content types.
public
remove_header_row() : mixed
Tags
remove_screen_options()
Remove screen options metabox from edit post screens.
public
remove_screen_options() : mixed
Tags
remove_thank_you()
Remove "Thank you for creating with wordpress" from the lower left of the footer of admin screens.
public
remove_thank_you() : mixed
Tags
remove_view_link_from_post_type()
Remove "view" link from admin screen for instance, modal, and figure posts.
public
remove_view_link_from_post_type(array<string|int, mixed> $actions, WP_Post $post) : mixed
Parameters
- $actions : array<string|int, mixed>
-
An array of row action links.
- $post : WP_Post
-
The post object.
Tags
restrict_content_editor_admin_menu()
Edit what users with the Content Editor can see on the dashboard
public
restrict_content_editor_admin_menu() : mixed
Tags
wppversionremove()
Remove WordPress version number from appearing in the lower right of admin footer.
public
wppversionremove() : mixed