Created
February 24, 2019 09:37
-
-
Save manchumahara/78701afe68b8c9714ba398137cd7cec2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//action | |
do_action('tagname'); | |
do_action('tagname2', 'asdasd', 2); | |
add_action('tagname', 'callback_function'); | |
add_action('tagname2', 'callback_function2', 10, 2); | |
function callback_function() | |
{ | |
# code... | |
} | |
function callback_function2(a, b) | |
{ | |
# code... | |
} | |
class TestClass{ | |
function __construct(){ | |
add_action('tagname', array($this, 'callback_function')); | |
add_action('tagname2', array($this, 'callback_function2'), 10, 2); | |
$t2 = new TestClass2(); | |
add_filter('tagname', array($t2, 'callback_function3'), 10, 3); | |
} | |
public function callback_function() | |
{ | |
# code... | |
// | |
} | |
public function callback_function2(a, b) | |
{ | |
# code... | |
} | |
} | |
class TestClass2{ | |
public function callback_function3(x, y, x){ | |
x = 2+y*z; | |
return x; | |
} | |
} | |
$object = new TestClass(); | |
//filter | |
$a = apply_filders('mytag', 2 , 'b', 10); | |
//add_filter('mytag', 'callback_function', 10, 3); | |
function callback_function(x, y, x){ | |
x = 2+y*z; | |
return x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment