Where can I save the widget code for wordpress?

I searched quite a lot on googled, but cannot find where I should save the code for the widget that I created. This is a little puzzling.

So, can someone tell me where should I save my widget?

Thanks, John.

+6
source share
3 answers

You need to put your widget code in the functions.php file of your current theme or inside the plugin. To put it in a plugin, create a new folder in the plugins folder and create a .php file with the name of the folder created in this folder. In this file, use this code to run your plugin:

<?php /* Plugin Name: Name Of The Plugin Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates Description: A brief description of the Plugin. Version: The Plugin Version Number, eg: 1.0 Author: Name Of The Plugin Author Author URI: http://URI_Of_The_Plugin_Author License: A "Slug" license name eg GPL2 */ ?> 

Obviously change the values ​​to something useful for your plugin. Then you can paste the widget code into this file, and it should be ready to use.

Sources:

http://codex.wordpress.org/Writing_a_Plugin

http://codex.wordpress.org/Plugin_API

+7
source

As far as I know, a widget (i.e. plugins) is included in your wp-content / plugins folder, for example. wp-content / plugins / YOUR WIDGET /

This is what you need?

0
source

You can save your code in wp-content \ themes \ YOUR-THEME-NAME \ functions.php file.

0
source

Source: https://habr.com/ru/post/886757/


All Articles