Skip to main content

Posts

Showing posts from January, 2015

WordPress add dashicons for new menu

When we add new menu page in WordPress in our custom plugins or theme functions we use the ‘ add_menu_page ‘ page function which can option to pass icon path of that menu. Here is the code snippet of the default example: add_action('admin_menu', 'members_downloads_menu'); function members_downloads_menu() { if (is_admin()){ add_menu_page('Members Downloads Options', 'Members Downlods', 'manage_options', 'members-downloads','members_downloads_page',plugins_url('your-plugin-folder/images/icon.png'), 80 ); } } Since WordPress version 3.8 there is option to use Dashicons instead of any images used as icons. Dashicons is the official icon font of the WordPress admin as of 3.8. Here is the code snippet to show where to replace the icon path to Dashicons: add_action('admin_menu', 'members_downloads_menu'); function members_downloads_menu() { if (is_admin()){ add_menu_page('Members Downloa

Beautify your codes online, format source codes

If you want to be a good coder then you must format your codes properly with block commenting. It will help you a lot to update or modify your code at any time. I have worked with many coders who rarely love their codes and I had so much pain to work on their codes. It is really a pain. There are several websites from where you can beautify (format) your codes instantly. Here are some good websites. 1.  prettyprinter.de Supports: PHP, Java, C++, C, Perl, JavaScript, CSS 2.  styleneat.com Supports: CSS 3.  dirtymarkup.com Supports: HTML, CSS, JavaScript 4.  jsbeautifier.org Supports: HTML, JavaScript The ‘Adobe Dreamweaver’ has a built-in tool for source formatting and it is awesome with perfect source format and killing of unnecessary spaces.