Wordpress Custom Plugin Installable code - wordpress

I have created my own custom plugin and when i just paste it in my plugin folder its working fine. now i wanted to make it installable so if anyone try to install in their project so they can install it with the given plugin upload menu in admin panel.

Copy the plugin_file_name.php in the folder /wp-content/plugins and its ready to work. But is better Create a folder and put in file.

Its very simple process to make your plugin installable. Just register 3 hooks in your plugin :
register_activation_hook(__FILE__, 'your_activation_function_name');
register_deactivation_hook(__FILE__, 'your_deactivate_function_name');
register_uninstall_hook(__FILE__, 'your_delete_function_name');
In your_delete_function_name function, please add code to remove the db changes you made and also code to remove your plugin directory.
Now just zip the folder of your custom plugin folder and its ready to be installed in any wordpress site. It worked for me as i am working in wordpress 4.6.

Related

what is the necessary steps of plugin customization

I want to customize my plugin but I am beginner, so please tell me what is the necessary steps for plugin customization either plugin is completed or simple.
If you already have that particular plugin(which you'd like to customize) installed on your wordpress, you may find the source code files under the following path:
[your_wordpress_dir]/wp-content/plugins/
If you want to customize a plugin that is available for download, you may follow the below steps
download it from wp_download_manager
unzip the package and find the source files where you can customize it.
put the customized plugin package in the above mentioned path in your wordpress directory(if you'd like to have this plugin installed in your wordpress project).
If you want your plugin to be available for public, you may add it to wp directory
first you have to download the .zip file and unzip it. Then customize it like you need and make it to a .zip again. Then upload it on your Wordpress site.

Alternate way to install plugins in wordpress

I am running wordpress on my local using Web Matrix. I am trying to install "Types - Custom Fields and Custom Post Types Management." plugin. But this is taking forever I am seeing message "Installing Plugin Types - Custom Fields and Custom Post Types Management (1/1)" from last one hour. The problem is I am not even getting error or installation fail notification. Anybody faced this kind of issue? and Is there any other way to install this plugin instead of doing it from UI available?
Hi TolerantCoder,
if you are not able to install plugins from admin than you can download plugins from wordpress plugins Directory than extract zip file and add in you wordpress project plugins directory.
I.e: D:\wamp\www\citicollege\wp-content\plugins\
in plugins directory you can copy paste plugins and activate from admin.

Export wp-content via WordPress dashboard?

Anyone know if there's a way to export the wp-content directory from the WP dashboard? I've inherited a project where the previous developer is not being cooperative. I would like to circumvent his uncooperativeness and just export the theme, uploads, plugins, etc.
you can use the backupwordpress plugin to get back up of all the wordpress and database and for the editing you can try file manager and other related plugin
The File Manager plugin was what did it for me. Install it, click the new icon in the sidebar to go to the plugins file-browser, and right click to download the folder or file you want.

Wordpress Plugin & Paths

Hey guys I have a plugin and its displaying info on /courses.php (using theme)
How can I get it to display info on /courses/single_course.php
I figured I'd just have to make a /courses/ folder in theme and have single_course.php inside that. However this doesn't seem to work.
I've tried googling but I'm struggling to figure out the keywords to solve this problem! ^_^
OK edit cause nobody is understanding:
I have plugin working. This is a custom plugin
I want to know how to make the following work http://www.example.com/plugin/index.php http://www.example.com/plugin/index.php
Currently to make http://www.example.com/plugin work you just need to create plugin.php in the theme directory and give a callback to a function in the plugin.
Creating /wp-content/theme/themename/plugin/index.php did not work as anticipated.
WP uses specific directories for placing its themes and plugins tom maintain organization standards.
// Pointing to theme WP themes directory
$_SERVER['DOCUMENT_ROOT']."/wp_content/themes/"
// Pointing to theme WP plugins directory
$_SERVER['DOCUMENT_ROOT']."/wp_content/plugins/"
or you can use the built in functions in wordpress
// for themes in any php file after headers
get_template_directory_uri() . '/js/custom_script.js'
// for plugins in you main plugin class
plugins_url('/js/newscript.js', __FILE__);
I would recommend keeping plugins in plugins and themes in themes. What you may be looking for is creating some extra plugin features which will require you to include you extra php functions and classes when the plugin in question is loaded.
First create a folder in under your plugin directory and chmod it with proper web securities
cd /path/to/wordpress/install/wp-content/plugins/your-plugin/
mkdir php
chmod 755
Next either copy or create and edit the new single_courses.php file. I've listed a quick method below if you are creating the new file from scratch. Otherwise just cp it over. In both cases we need to insure proper web access right using chmod.
cd /path/to/wordpress/install/wp-content/plugins/your-plugin/
echo -n "/*Extra Plugin Functions*/" > single_courses.php
chmod 644 single_courses.php
Now we need to be sure to include the new file in our main plugin file
/* Main Plugin File :: ./wp-content/plugins/your-plugin/theplugin.php */
...
include_once $_SERVER['DOCUMENT_ROOT']."/wp_content/plugins/you-plugin/php/single_courses.php"
...
Thats the basic way to go about it. Use the same process for hooking theme php files as well. Always make sure when creating directories and files on your server that proper security is put into effect or you open up your web directory and or server to get hacked.
Hope it helps...
You have to give us more information on what plugin you are using and what you are trying to achieve. The solution may be as simple as pasting a Plugin provided shortcode into the post area of the desired page. Alternatively you may have to edit the plugin itself.

How can I upload and replace a Wordpress theme?

I just created my first Wordpress theme. I zipped it up and installed it on the server using the Wordpress 3.0.1 Administration Panel. That worked fine. But now I've made a few changes to my theme and I want to update it. I couldn't find an "upgrade" option for uploaded themes so I tried just uploading it again. This is what I got.
Installing Theme from uploaded file:
my-theme.zip
Unpacking the package…
Installing the theme…
Destination folder already exists.
/path/to/wordpress/wp-content/themes/my-theme/
Theme install failed.
Is there any way to update the theme through the administration panel? Or do I have to access the filesystem somehow (FTP, etc.) and delete the directory first?
You can do it all through the control panel. Each theme has a Delete link that you can use to wipe it from the server's file system. Once it's gone, you can re-intall your updated version.

Resources