Everybody php master help me to see what this piece of code means
function Apply_filters ($tag, $value) {
Global $WP _filter, $merged _filters, $WP _current_filter;
$args = Array ();
if (isset ($wp _filter[' all ')) {
$WP _current_filter[] = $tag;
$args = Func_get_args ();
_wp_call_all_hook ($args);
}
if (!isset ($wp _filter[$tag])) {
if (isset ($wp _filter[' all '))
Array_pop ($wp _current_filter);
return $value;
}
if (!isset ($wp _filter[' all '))
$WP _current_filter[] = $tag;
if (!isset ($merged _filters[$tag])) {
Ksort ($WP _filter[$tag]);
$merged _filters[$tag] = true;
}
Reset ($wp _filter[$tag]);
if (empty ($args))
$args = Func_get_args ();
do {
foreach (array) current ($WP _filter[$tag]) as $the _)
if (!is_null ($the _[' function ')) {
$args [1] = $value;
$value = Call_user_func_array ($the _[' function '], Array_slice ($args, 1, (int) $the _[' Accepted_args '));
}
} while (Next ($wp _filter[$tag])!== false);
Array_pop ($wp _current_filter);
return $value;
}
function The_permalink () {
echo apply_filters (' The_permalink ', Get_permalink ());
}
Share to:
------Solution--------------------
Common function-apply_filters ()
Description
Call the function added to the filter hook. View a list of filter hooks on the plugin API.
By calling this function, you can invoke a callback function attached to the filter hook $tag. Call this function with the name of the new hook specified by the $tag parameter to create a new filter hook.
Usage
Parameters
$tag
(string) (required) name of the filter hook
Default value: None
$value
(mixed) (required) a value that may be modified by a filter connected to the $tag
Default value: None
The value returned
(mixed) After all the join functions have been applied to the function, the result of $value is returned.
Note: The type of the return value should be the same as the $value type, such as a string or an array.
How to use:
$tag: You can customize any value
$value: You can customize any value
------Solution--------------------
References:
Quote: References:
Common function-apply_filters ()
Description
Call the function added to the filter hook. View a list of filter hooks on the plugin API.
By calling this function, you can invoke a callback function attached to the filter hook $tag. Call this function with the name of the new hook specified by the $tag parameter to create a new filter hook.
Usage
Parameters
$tag
(string) (required) name of the filter hook
Default value: None
$value
(mixed) (required) a value that may be modified by a filter connected to the $tag
Default value: None
The value returned
(mixed) After all the join functions have been applied to the function, the result of $value is returned.
Note: The type of the return value should be the same as the $value type, such as a string or an array.
How to use:
$tag: You can customize any value
$value: You can customize any value
Filter hooks? What the hell is that?
I choose to use WordPress to make a blog, first display all the posts in the blog.php page (pagination), and then click on the title to enter the full blog content.
Why when I click on the title of the post, I jump to the index.php page, if it is someone else to write the template, in the index.php display all the blog post, click on the title after the index.php show the full post, why change a page can not? The code might look like this:
!--? php if (have_posts ()):?-->//Check for logs
!--? php while (have_posts ()): The_post ( );?-->//loop
"title="!--? php the_title (),?--"class=",
" in the case of a blog post with a log