Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Installation

Mattias edited this page Oct 13, 2020 · 1 revision

1. Installation

Download WPTS and place all files in your theme/plugin directory /wp-content/themes/your-theme/, /wp-content/plugins/your-plugin/

Open your WordPress themes functions.php or plugin main file and add the following code

require_once('wp_theme_settings.php'); 

Add both CSS & JS file to Wordpress with admin_enqueue_scripts action hook.

add_action('admin_enqueue_scripts', 'wpts_enqueue_scripts');
function wpts_enqueue_scripts(){
    wp_enqueue_style('wp_theme_settings', get_template_directory_uri().'/wp_theme_settings.css');
    wp_register_script('wp_theme_settings',get_template_directory_uri() . '/wp_theme_settings.js', array('jquery'));
    wp_enqueue_script('wp_theme_settings');
}

Replace get_template_directory_uri() function with plugin_dir_url() if you're writing a plugin.

Clone this wiki locally