I have some php code that I want to implement into my site. If I create a child theme, is it possible that I can add this code in and have it function the way it is intended. It is just a form that I can place in an iframe.

Here is a file called home.php I created..

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>My Site</title>
    </head>
    <body>
        <iframe width="480" height="70" src="viral.php"></iframe><br>
        <a href="http://www.tvcmatrix.com/<?php 
                if (!empty ( $_SERVER['QUERY_STRING'])){
                    echo substr($_SERVER['QUERY_STRING'],3);
                    }else{
                        echo 'mhammonds';
                    }
                    ?>" target="_blank">Checkout at TVC Matrix</a>
    </body>
</html>

Here is a file called viral.php I created..

<?php  
        function username(){
            if(isset($_GET['id'])){
                echo "Your URL is: www.mca.com/?id=" . "$_GET[id]";
                }else {                   
            }
        }
        $USERNAME = username();
?>
<!DOCTYPE html>
    <html>
        <head>
            <title>Your Site</title>
        </head>
        <body>
            <form action="viral.php" method="get" name="input" target="_self">
            Your TVC Matrix Associate ID: <input type="text" name="id" id="username"/>
            <input type="submit" value="Submit" />
            </form>
        </body>
    </html>

If this is possible, can I do it with any wordpress theme?

Read more here: How do I add php code to a wordpress theme?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: