Saturday, July 9, 2022
HomeWordPress DevelopmentWordpress Plugin Embrace Not Working

WordPress Plugin Embrace Not Working


I’ve a folder known as contains and inside that folder I’ve a file known as take a look at.php which incorporates some content material. I want to embrace that file inside my pluginname.php file. I’m making an attempt however I get error. I’ll present my code and the error message.

Code
Class

<?php
/*
  Plugin Identify: pluginanme
  Description: plugindescription
  Model: 1.0.0
  Creator: Plugin Group
  Creator URI: https://pluginname.com/
*/

if (!outlined('ABSPATH')) exit; // Exit if accessed immediately


class MyNewFunction
{

  operate __construct()
  {
    world $wpdb;
  }


  operate customFunction()
  {
    
    include_once( plugin_dir_path( __FILE__ ) . 'contains/take a look at.php' );
    
   
  }

  $this->customFunction();

}

$newFunction = new MyNewFunction();

Code take a look at.php file

<?php
    operate theTest() {
        echo "THIS IS THE TEST CONTENT"

    }
     theTest();
?>

Error Message:
Parse error: syntax error, surprising ‘customFunction’ (T_STRING), anticipating operate (T_FUNCTION) or const (T_CONST) in ….

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments