AI Verified
Add Training Videos to Wordpress Admin Sidebar
Ever wanted to add a Label to your Wordpress Sidebar called Training Vids that leads to a page that lists your specified YouTube Videos?
PHP
Voted: 3 by 3 user(s)
Add this to Code Snippets, and then modify the label and YouTube URLs.
Scroll down to see more snippets from this codevault.
The author has indicated that this snippet is compatable up to wordpress version: 6.1
Our AI bot has checked this snippet is compatable up to wordpress version: 6.1
Free & Pro
Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.
Pro Only (Coming Soon)
You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.
Last modified:
16/10/2023
This snippet has the following status:
AI Verified
This snippet has been tested by our AI bot, see any comments below.
AI Bot Comments:
Found 0 vulnerabilities
3
1 year ago
And if you ever want to show a PDF instead of a Video Link then use this format: 'url' => 'https://example.com/path/to/pdf',
1 year ago
The provided code snippet registers a new section in the WordPress admin menu called "Training Videos" and displays a list of training videos in that section. The implementation of this functionality is achieved through the use of two functions: add_training_section_to_admin_menu() This function registers a new menu item in the WordPress admin menu. It accepts the following arguments: $page_title (string): The text that appears in the title tag of the web page when the menu item is selected. $menu_title (string): The text that appears in the WordPress admin menu for this item. $capability (string): The capability required for a user to view this menu item. $menu_slug (string): The unique identifier for this menu item. $function (callable): The function that will be called when this menu item is selected. $icon_url (string): The URL for the icon that will be displayed next to this menu item. $position (int): The position of this menu item in the WordPress admin menu. In this code snippet, add_menu_page() is called with the appropriate arguments to create the "Training Videos" menu item. display_training_videos_page() This function is called when the "Training Videos" menu item is selected. It displays a list of training videos using the $videos array. The $videos array contains an array of associative arrays, each of which contains a title and a URL for a training video. The function creates an unordered list of video titles and links, using a foreach loop to iterate over the $videos array. add_action( 'admin_menu', 'add_training_section_to_admin_menu' ); This line of code adds the add_training_section_to_admin_menu() function to the admin_menu action hook, which is called when the WordPress admin menu is initialized. This ensures that the "Training Videos" menu item is registered and displayed in the WordPress admin menu.
1 year ago
Great explanation Justin :)
1 year ago
No need thank chatgpt. Just needed some info on what some of it did.
1 year ago
Great snippet, thank you. Tip for users: the menu displays for the administrator role. To get it to display for the editor role change line 5 from ‘manage_options’ to ‘publish_pages’
Please see some snippets below related to this snippet..
WordPress Admin
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
If you want to create new image sizes, this is the code snippet you've been looking for. Can be really useful for, for example, creating consistently non-sqare sized product images in WooCommerce.
WordPress Admin
AI Verified
Added: 7 months ago
Last Updated: 4 months ago
Add your Logo and Company Details to the WordPress Dashboard as a Screen Option
WordPress Admin
AI Verified
Added: 8 months ago
Last Updated: 6 months ago
Tired of searching your admin menus to find the parent of your current page? Yea, me too! It's time we.... Add Back Buttons to Edit Screens in the WordPress Admin... or at least try to! - <a href="htt...
These are some popular snippets from this users codevault..
Performance
AI Verified
Added: 1 year ago
Last Updated: 4 weeks ago
Remove Unused Javascript - and improve your Page Speed Insight Score
WooCommerce
Pro Verified
Added: 1 year ago
Last Updated: 2 days ago
Deactivate some WooCommerce Checkout Fields from showing
Elementor
AI Verified
Added: 7 months ago
Last Updated: 1 month ago
This can be used for any WordPress Builder to aid working with CSS Grids.
Category
Snippet Status