wordpress payment plugin part2

wordpress payment plugin

Hello again.
after 2 week i’m here.
my first payment plugin did accept by Wordpress code review team and for now i’m a little busy for my new project.
new project is for Tezos network it’s a concept, the new one is harder than older and i think my skills did grow on it :D

ok let’s talk about how make payment plugin in part 2 :)

in last part we did speak about how make a wordpress plugin.
in this part we will talk about shortcode.

first step i will refer you to official wordpress document : shortcode
i did this because i don’t want to give a fish to you. you must to learn how find you problem answer.
and if you have problem with official document you must to learn to use it.
for now let’s to explain shortcodes more.

What is shordcode in wordpress.

did you ever seen something like this ?

1
[gallery]

more about gallery in wordpress

in wordpress, developers can do a lot of things with shortcodes.
in this plugin we must to handle a page refer user after any update of payment (success or fail).
we haven’t access to make a route (with installed template) in plugin.
i’m using shortcode to make a redirect page for payment. like this picture :

Sample-of-my-payment-page

so i’m bad to explain things without sample. let’s talk about how we can made on of them.

make a wordpress shortcode in our plugin.

it is tooooo much easy.
just we need to call a wordpress function and a function as a callback.
watch this :

1
2
3
4
add_shortcode('my-awesome-name-for-shortcode', "my_awesome_name_for_callback_funciton");
function my_awesome_name_for_callback_funciton(){
// Put some Awesome code here please.
}

it’s realy easy.
so now we have a shortcode and we can put in on our post or page like this :

1
[my-awesome-name-for-shortcode]

if you want to refer callback to a class (playing with oop in wordpress 😅 ) just put array to callback place like this : +

final speek

it’s too much easy. don’t afraid to make a plugin and test it on your own local wordpress site :)
in next part we will talk about RestApi. there is to much things to say.

if you like start to make a plugin but u need help, don’t afraid to contact with me 😉