Output the admin menu_position for each item

I’ve just finished a plugin that (amongst other things) allows the reordering of the admin menu. The way the admin menu is constructed is not the easiest thing to work with at all. That being said have a look at the admin_menu hook. You can access the global $menu array at that point – which … Read more

Adding admin top-level menus

You can change the first Submenu text with the following script: function __test_menu() { global $submenu; //var_dump($submenu); //check yourself $submenu[‘unc_gallery_admin_menu’][0][0] = __( ‘Test’, ‘textdomain’ ); } add_action( ‘admin_menu’, ‘__test_menu’ ); Please note, your plugin is error-prone, throwing warning messages. Always develop things with WP_DEBUG to true. And don’t write hardcore texts, better write them in … Read more

Print Dashboard submenu name and filename

If you want them in an unordered list: echo “<ul>\r\n”; foreach ( $submenu as $group => $item ) { foreach ( $submenu[$group] as $key => $value ) { echo “<li>” . $submenu[$group][$key][0] . ” > ” . $submenu[$group][$key][2] . “</li>\r\n”; } } echo “</ul>”; This results in: <ul> <li>Home > index.php</li> <li>Updates > update-core.php</li> <li>Library … Read more

Editing a text file from plugin menu

First of all put these all code inside in init hook, and use plugin_dir_path() func to get plugin dir path. add_action(‘init’,function(){ $plugindir = plugin_dir_path( __FILE__ ); if(isset($_POST[‘addition’])){ $file_open = fopen($plugindir.”dates.txt”,”w+”); fwrite($file_open, $_POST[‘addition’]); fclose($file_open); } echo ‘<form action=”‘.$_SERVER[‘PHP_SELF’].'” method=”POST”> <textarea name=”addition” COLS=50 ROWS=20>’; $datalines = file ($plugindir.”dates.txt”); foreach ($datalines as $zz) { echo $zz; } echo … Read more

meta box on new admin page

You are trying to create a new admin page with add_pages_page(). Meta boxes are only for existing post types, not for admin pages. You need to create your fields like on a normal admin page. You should read the official codex about this first: Creating Options Pages For a simple start take a look at … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)