Mika
Forum Replies Created
-
Forum: Hacks
In reply to: How to change hard coded label and look it up in a PO file?Forum: Hacks
In reply to: Trouble to translate own plugin (add_menu_page/add_submenu_page)Okay, it looks like a typo error – I create a new plugin just with the basics and everything is fine.
Folder:
/languages/
test-plugin.php<?php /* Plugin Name: Test Plugin Description: Test Plugin Version: 4.2 Author: Mika Domain Path: /languages Text Domain: test-plugin */ // Action add_action( 'init', 'tp_init' ); add_action( 'admin_menu', 'add_my_custom_menu' ); add_action( 'plugins_loaded', 'tp_load_plugin_textdomain' ); // Hooks register_activation_hook( __FILE__, 'tp_activation' ); register_deactivation_hook( __FILE__, 'tp_deactivation' ); function tp_load_plugin_textdomain() { load_plugin_textdomain( 'test-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); } function tp_init() { } function tp_activation() { } function tp_deactivation() { } function add_my_custom_menu() { //add an item to the menu add_menu_page ( 'Test Plugin Page-Title', __('Test Plugin EN', 'test-plugin'), 'manage_options', 'tp_page', 'tp_admin_page_function', 'dashicons-businessman' ); add_submenu_page ( 'tp_page', 'Settings', __('Settings', 'test-plugin'), 'manage_options', 'tp_setting_page', 'tp_admin_setting_page' ); } function register_submenu_page() { } function tp_admin_page_function() { ?> <div class="wrap"> <h2>Test-Plugin</h2> Content... </div> <?php } function tp_admin_setting_page() { ?> <div class="wrap"> <h2>Settings</h2> Content... </div> <?php }
I create with PoEdit a new pot file and the po/mo-files (filename must be “test-plugin-de_DE.mo/po” for german). And taadaaa, it works…
Solved!
Forum: Hacks
In reply to: how to remove padding when shrinking window – responsiveHi ccarlow,
/*@media only screen and (min-width:768px)*/ /* INSERT HERE YOUR PADDING-TOP */ #logo { padding-top: 42px; float: left; max-width: 100%; } /*media all*/ #logo { /* DELETE HERE YOUR PADDING-TOP */ /* padding-top: 42px; */ }
Forum: Hacks
In reply to: register_activation_hookHi enriquerene,
if a user click the link to activate the plugin, the function on register_activation_hook() is fired.
You can use this hook to add some stuff to your plugin (create your own database tables or insert some default values or something like that).
Take care (described in the documentation) that after an activation a instant redirect is performed. Maybe a solution for your issue with your implementation of your hook…
Forum: Hacks
In reply to: Trouble to translate own plugin (add_menu_page/add_submenu_page)Hi bcworkz,
thanks for your answer.
Yes, you are right – the textdomain must be identical. It is identical, but I have copied the load_plugin_textdomain code from an old file – upsi. ??
In my testcase the textdomain is all over the same and it works but not on the admin menu… ??