Need help moving to the next step with my plugin
-
Hi there. Thanks in advance to everyone who helps out here!
I have decided to create my first WordPress plugin and everything seems to be pretty straight forward and the documentation is great. However, I am stuck. ??
Below is my main plugin file code.
<?php /* Plugin Name: The Web Design Toolbox Plugin URI: https://www.thewebdesigntoolbox.com Description: A WordPress plugin that brings you many tools to easily create web elements. Our goal is to be a one stop solution for all your web design tools. Version: 1.0 Author: Jonathon Hammond Author URI: https://www.yourwebdesigntoolbox.com License: GPL2 */ /* Copyright 2013 Your Web-Design Toolbox (email: [email protected]) */ ?><?php // some definition we will use define( 'twtb_PUGIN_NAME', 'The Web Design Tool Box'); define( 'twtb_PLUGIN_DIRECTORY', 'the-web-design-toolbox'); define( 'twtb_CURRENT_VERSION', '1.0' ); define( 'twtb_CURRENT_BUILD', '1' ); define( 'twtb_LOGPATH', str_replace('\\', '/', WP_CONTENT_DIR).'/twtb-logs/'); define( 'twtb_DEBUG', false); # never use debug mode on productive systems // i18n plugin domain for language files define( 'EMU2_I18N_DOMAIN', 'twtb' ); // how to handle log files, don't load them if you don't log require_once('twtb_logfilehandling.php'); // load language files function twtb_set_lang_file() { # set the language file $currentLocale = get_locale(); if(!empty($currentLocale)) { $moFile = dirname(__FILE__) . "/lang/" . $currentLocale . ".mo"; if (@file_exists($moFile) && is_readable($moFile)) { load_textdomain(EMU2_I18N_DOMAIN, $moFile); } } } twtb_set_lang_file(); // create custom plugin settings menu add_action( 'admin_menu', 'twtb_create_menu' ); //call register settings function add_action( 'admin_init', 'twtb_register_settings' ); register_activation_hook(__FILE__, 'twtb_activate'); register_deactivation_hook(__FILE__, 'twtb_deactivate'); register_uninstall_hook(__FILE__, 'twtb_uninstall'); // activating the default values function twtb_activate() { add_option('twtb_option_3', 'any_value'); } // deactivating function twtb_deactivate() { // needed for proper deletion of every option delete_option('twtb_option_3'); } // uninstalling function twtb_uninstall() { # delete all data stored delete_option('twtb_option_3'); // delete log files and folder only if needed if (function_exists('twtb_deleteLogFolder')) twtb_deleteLogFolder(); } function twtb_create_menu() { // create new top-level menu add_menu_page( __('Design Toolbox', EMU2_I18N_DOMAIN), __('Design Toolbox', EMU2_I18N_DOMAIN), 0, twtb_PLUGIN_DIRECTORY.'/twtb_settings_page.php', '', plugins_url('/images/icon.png', __FILE__)); add_submenu_page( twtb_PLUGIN_DIRECTORY.'/twtb_settings_page.php', __("Element Generator", EMU2_I18N_DOMAIN), __("Element Generator", EMU2_I18N_DOMAIN), 0, twtb_PLUGIN_DIRECTORY.'/twtb_settings_page.php' ); add_submenu_page( twtb_PLUGIN_DIRECTORY.'/twtb_settings_page.php', __("Support", EMU2_I18N_DOMAIN), __("Support", EMU2_I18N_DOMAIN), 9, twtb_PLUGIN_DIRECTORY.'/twtb_settings_page2.php' ); } function twtb_register_settings() { //register settings register_setting( 'twtb-settings-group', 'new_option_name' ); register_setting( 'twtb-settings-group', 'some_other_option' ); register_setting( 'twtb-settings-group', 'option_etc' ); } // check if debug is activated function twtb_debug() { # only run debug on localhost if ($_SERVER["HTTP_HOST"]=="localhost" && defined('EPS_DEBUG') && EPS_DEBUG==true) return true; } ?> <?php add_action( 'admin_enqueue_scripts', 'safely_add_stylesheet_to_admin' ); /** * Add stylesheet to the page */ function safely_add_stylesheet_to_admin() { wp_enqueue_style( 'prefix-style', plugins_url('style.css', __FILE__) ); } ?>
And here is a sidebar.php that I pulled into one of my menu items for the plugin
<?php ?> <ul> <li><h3>The Toolbox</h3></li> <li><a href="#">CSS Button Generator</a></li> <li><a href="#">CSS Transition</a></li> <li><a href="#">CSS Gradient</a></li> <li><a href="#">DIV Style</a></li> <li><a href="#">Paralax</a></li> <li><a href="#">More Tools</a></li> </ul> <?php ?>
I am wanting to create a PHP file for each feature here… So for example create the following……
button_gen.php
css_gradient.php
etc, etc…I tried to link to the file with traditional HTML but no luck.
Am I taking the wrong approach here?
- The topic ‘Need help moving to the next step with my plugin’ is closed to new replies.