I tried to use class and object in plugin. I made a simple function with a shortcode
but it is executing the function without pasting the shortcode to any page/post.
class example{
function ex_funct(){
?>
<h3>Hello</h3>
<?php
}
}
$obj = new example();
add_shortcode('examp_code',$obj->ex_funct());
Why it is showing Hello at admin as well front end header without pasting the code examp_code
?
What is happening here?
class Example
&new Example();