0
votes

I'm currently developing a options-page for a small wordpress-plugin. I've already created the options-page with add_options_page() and also filled it with some nice options.

The only thing that's missing is the page-title. In selfsame I would like to include the name of the 'options-general.php'-page, because the options-page of the plugin is located in the menu under "Settings" (of course, I could simply write "Settings", but that's not multilingual).

For this reason I would like to get the page title of the Settings-page that's in the left admin-menu.

Of course, I could just do the following: add_options_page('Settings - pluginname', ...), but then "Settings" is not multilingual.

I need to pass the title of the settings-page + a specific word (e.g. "pluginname") to add_options_page().

I just want to get the title of the settings-page (options-general.php) with PHP.

2
Better option is Plugin_Name Settings, that i mostly used in plugins. And its meaningful to others.jogesh_pi
@jogesh_pi Yeah, but the word "Settings" then is still not multilingual. So i need to get the "Settings"-page-title.Leonard
can you share your add_options_page()jogesh_pi
@jogesh_pi I think we're talking past each other. I would just like to output the title of the "Settings"-page (goo.gl/1NjlHe).Leonard
What if you put __('Settings') . ' : Plugin Name'? This way Settings is translated normally.brasofilo

2 Answers

0
votes

Here is my simple wordpress code to create simple plugin with menu title settings....

/*plugin name:demo*/
add_action('admin_menu','demo1');
function demo1(){

add_menu_page('title','Settings','8','demo-page','sho_demo');

}
function sho_demo(){
echo 'a very simple php code to create wordpress plugin.';
} 
0
votes

To get title of the settings page you can use get_admin_page_title() function.

to pass the text-domain to the title you can do the following

<h1><?php echo esc_html__( get_admin_page_title(), 'text-domain' ); ?></h1>