| Server IP : 43.153.74.48 / Your IP : 216.73.216.28 Web Server : LiteSpeed System : Linux VM-0-13-ubuntu 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www ( 1002) PHP Version : 8.1.29 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/stainlesstint.com/wp-content/plugins/custom-codes/lib/views/ |
Upload File : |
<?php
/**
* WP Top Admin Bar view.
*
* @since 2.0.0
* @package Custom_Codes
*/
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
/**
* Add menu items.
*
* @param object $wp_admin_bar Returns the WordPress Admin Bar object.
*/
function codes_wp_adminbar( $wp_admin_bar ) {
global $codes_posts;
if ( ! current_user_can( 'manage_options' ) // Only show for admins.
|| ! boolval( get_option( '_codes_admin_bar' ) ) // If hidden from the settings.
) {
return;
}
// Create the menu.
$wp_admin_bar->add_node(
array(
'id' => 'codes',
'title' => '
<span class="ab-icon custom-codes"><img src="' . CODES_PLUGIN_URL . 'assets/image/icon-codes-light.svg"></span><span class="ab-label">' . __( 'Codes', 'custom-codes' ) . '</span>
<style> #wp-admin-bar-codes .ab-icon.custom-codes{ opacity: 0.6; } #wp-admin-bar-codes:hover .ab-icon.custom-codes{ opacity: 1; } </style>
',
'href' => admin_url( 'edit.php?post_type=custom-code' ),
)
);
foreach ( $codes_posts as $key => $code_post ) {
if ( $key > 8 ) {
break;
}
$wp_admin_bar->add_node(
array(
'id' => 'codes-' . $code_post->ID,
'title' => empty( $code_post->post_title ) ? __( 'Untitled Code', 'custom-codes' ) : $code_post->post_title,
'href' => admin_url( "post.php?post=$code_post->ID&action=edit" ),
'parent' => 'codes',
)
);
}
$wp_admin_bar->add_node(
array(
'id' => 'all_codes',
'title' => __( 'All Codes', 'custom-codes' ),
'href' => admin_url( 'edit.php?post_type=custom-code' ),
'parent' => 'codes',
)
);
$wp_admin_bar->add_node(
array(
'id' => 'new_code',
'title' => __( '+ New Code', 'custom-codes' ),
'href' => admin_url( 'post-new.php?post_type=custom-code' ),
'parent' => 'codes',
)
);
}
add_action( 'admin_bar_menu', 'codes_wp_adminbar', 9999 );