wordpress payment plugin Part1
Hey there, how are you ? i want to write a little about my experince as a wordpress plugin developer in week one of 100DaysOfCode. you can find some of my plugin in github.
so let’s start to know what we need. and make a payment plugin like this : wp-zilon-woocommerce
i don’t want to explain what is the wordpress but you know wordpress is one of the popular CMS for make website and because Woocommerce, wordpress now is a good choice to make a shop Website.
we want to make a simple plugin here. so you need some basics tools like :
- Wordpress installed on a webservice (you can use remote host or install and configure Apache || if you are in windows use Xampp)
- not bad knowledge of PHP (you can grow in project so if you are not good in php also you can make it)
- a little funny code editor (i use both Vscode and Vim)
if you have a problem to make your enviroment tell me and i will help you as far as I can.
when you install wordpress you have something like this :
we must to put our plugin in
wp-content/plugins/. just choice a name for your plugin ( if you want to publish plugin in wordpress repo start name of your plugin must be include
wp- character ) and make a folder in above directory. we must to make something like this :
- care about name choicing because duplicate name and functions will make confilict in wordpress.
we are in peace here :D and we need some comments in our plugin. something like this :
i will explain more about text domain in future.
you must to put this comment on first of your plugin file.
detect a problem
in php user can access to you plugin directly. (it’s a problem for our wordpress security) worpdress has a easy way to fix this issue. you must to put
defined('ABSPATH') || exit('No Direct Access.'); after
<?php in your each file. this code will check if a ABSPATH (it’s a wordpress local variable) isset means user running this plugin how we want. but if not set means user want to make a not valid request to our serve and we must to kill this connection.
some usefull defines
it’s good to make some routes define in our plugin. always i will make this :
this const variables will help us in future :)
now your plugin is ready. i will show how to make shortcode in next part of this post.
be happy untile the next post :) good luck.