Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forum: Fixing WordPress
    In reply to: Php file?

    If you can write and run some PHP code then…

    <?php
    
    $copyFrom = '/public_html/.../oldTheme/file.php';
    $copyTo = '/public_html/.../newTheme/file.php';
    
    if(!copy($copyFrom, $copyTo)){
        echo 'copy failed';
    }
    
    ?>

    You didn’t write a PHP class, but if you had, this is how you’d access it.

    <?php
    
    // This is a PHP class.
    class myClass
    {
        public $variable1 = 1;
    
        public function sayHi(){
            return 'hi';
        }
    
    }
    
    // This is how you create an instance your class.
    $object = new myClass;
    
    // This is how you call a function inside of your class.
    echo $object->sayHi();
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)