Welcome, all people today we are learning how to add PHP to WordPress so keep silent and read this blog. Here are two examples to look at so see the first example.
Example 1:-
First, open your WordPress dashboard now click the new plugin and search Insert add PHP Snippet plugin, and then now install this plugin and activate this. now we are dashboard sidebar add new menu XYZ PHP Code. then click here now see the open dropdown menu open click PHPCode Snippet link. then open a new page and click add new PHP code snippet button. now the first tracking name applies ( Tittle ).second add PHP code and you see the Update button press here. copy the short code and open a new post and search short code then copy code past here. now click publish button and are see PHP id totally work.
Click add New Plugin link
Search Insert PHP Code Snippet Plugin and install this plugin
Now install plugin activate and you are see add new menu add side bar XYZ PHP Code.
Now if you move the cursor over the New Side menu XYZ PHP code, the New Dropdown menu will open. Click on PHP code snippet.
Click the Add New PHP Code Snippet button
Now add tracking name mean add title and add new PHP Code. Then after click Update Button.
Copy Short Code here.
Open a new post and search short code and past copy code here.
Write some word and click submit button. now you are see PHP work
Output:-
Why Insert PHP Code Snippet Does not Work in WordPress?
This is a very simple mistake I will explain this follow me and read this blog here two examples here first work PHP form and second not work PHP
Example 2:-
We saw in the first example how to add a PHP form. Now we will see in the second example how Echo works.
Output:-
Why Insert PHP Code Snippet Does not Work in WordPress
We add internal input when adding a PHP form
then input under type=”submit” and name=”submit” is not work
Work | Not Work |
<form action=”” method=””> <input type=”text” name=”firstname”> <input type=”submit” name=”clickhere”> </form> </php if(isset($_POST[‘clickhere’])) { $firstname = $_POST[‘firstname’]; echo $firstname; } ?> | <form action=”” method=””> <input type=”text” name=”name”> <input type=”submit” name=”submit”> </form> </php if(isset($_POST[‘submit’])) { $name = $_POST[‘name’]; echo $name ; } ?> |