Have you tried with require and require_once PHP expressions?
Maybe, something like this:
require_once("YourClass.php"); // Here with the path to YourClass.php
class AnotherClass extends YourClass
{
...
}
I have this code:
final class GoSomewhere extends NF_Abstracts_Action
Problem is, that I normally work with laravel, where everything has namespaces. That is why i also try to do this in wordpress with my plugin. But when I do this, my autoloader tries to load NF_Abstracts_Action from my own Namespace. The NF_Abstracts_Action has no namespace... can I require it and extend it... but how?
@pixelairport The class will exist in the “global” namespace, so you either need to import it as is, or prepend a backslash to the class name when extending it:
use NF_Abstracts_Action;
final class GoSomewhere extends NF_Abstracts_Action
{
//
}
Or:
final class GoSomewhere extends \NF_Abstracts_Action
{
//
}
Please or to participate in this conversation.