Support » Plugins and Hacks » Hacks » Adding settnings page for plugin?

Adding settnings page for plugin?

  • Hi! Do you have any codes for making a settnings page for a normal Javascript-code? I would like it only to put the thing you write in the “settings-box” to this part of the HTML/JS code:

    dictionary = [{
                word: 'Input 1 A',
                translations: ['Input 1 B']
            }, {
                word: 'Input 2 A',
                translations: ['Input 2 B', 'Input 2 C (Optional)']

    Settnings page shall be able to have over 40 inputs.
    Right now the only thing I got is:

    Plugin Name: Glostestaren
    Plugin URI: http://glosor.tommielag.se/
    Description: Ett enkelt plugin för att förhöra dig/dina användare på glosor.
    Version: 1.2
    Author: Tommie Lagerroos
    Author URI: http://tommielag.se
    License: GPL
    add_action( 'admin_menu', 'my_plugin_menu' );
    function my_plugin_menu() {
    	add_options_page( 'Glostestaren', 'Glostestaren', 'manage_options', 'glostestaren_installningar', 'my_plugin_options' );
    function your_plugin_settings_link($links) {
      $settings_link = '<a href="options-general.php?page=glostestaren_installningar">Ändra glosor</a>';
      array_unshift($links, $settings_link);
      return $links;
    $plugin = plugin_basename(__FILE__);
    add_filter("plugin_action_links_$plugin", 'your_plugin_settings_link' );

    Thanks, Tommie (Im new so mods if im doing something wrong please tell me | Sorry for nooby level of PHP (Actually I can nothing about it) and for bad english…)

Viewing 1 replies (of 1 total)
  • For making a settings page, read Settings API.

    To pass data from PHP to javascript, either dynamically output the data to a <script> block on the page or use wp_localize_script(). Which means you must link your javascript to your page with wp_enqueue_script().

    You must enjoy difficult challenges, because you are struggling with both PHP and English languages! Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Adding settnings page for plugin?’ is closed to new replies.