0

I am trying to run a wordpress using xampp with theme 'Total' from themeforest.

It says

Fatal error: Cannot use $this as parameter in /Applications/XAMPP/xamppfiles/htdocs/wp-content/themes/Total/framework/3rd-party/contact-form-7.php on line 38

I referred this link and other websites outside of stack overflow too.

The code for contact-form-7.php as follows,

<?php
/**
 * Contat Form 7 Configuration Class
 *
 * @package Total WordPress Theme
 * @subpackage 3rd Party
 * @version 3.6.0
 */

if ( ! class_exists( 'WPEX_Contact_Form_7' ) ) {

    class WPEX_Contact_Form_7 {

        /**
         * Start things up
         *
         * @version 3.6.0
         */
        public function __construct() {

            // Remove CSS Completely - theme adds styles
            add_filter( 'wpcf7_load_css', '__return_false' );

            // Remove JS
            add_filter( 'wpcf7_load_js', '__return_false' );

            // Conditionally load JS
            add_action( 'wpcf7_contact_form', array( 'WPEX_Contact_Form_7', 'enqueue_js' ), 1 );

            }

        /**
         * Load JS conditionally
         *
         * @version 3.6.0
         */

        public static function enqueue_js( $this ) {
            if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
                wpcf7_enqueue_scripts();
            }
        }

    }

}
new WPEX_Contact_Form_7();

Here's what i did,

I first installed it in my office computer and it worked perfectly. Now i tired to implement the same in my personal laptop.

Hence simply copied my htdocs folder and replaced in my laptop. Also exported and imported the Database into phpMyAdmin.

Francisco
  • 10,918
  • 6
  • 34
  • 45

1 Answers1

1

Try removing $this, e.g.

public static function enqueue_js() {
    if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
        wpcf7_enqueue_scripts();
    }
}

See code at gist.

kenorb
  • 155,785
  • 88
  • 678
  • 743
D. Pachauri
  • 244
  • 2
  • 8