//Add new filter
add_action("aw_init","register_my_filter");
function register_my_filter(){
aw_add_filter('[post-name=SLUG]','Show only in the post by SLUG','function_my_filter');
}
//Function to call the new filter
function function_my_filter($r,$filter){
global $post;
//Get the filter value if necessary. (In the "[category]" example this is not necessary)
$post_slug = preg_replace("#\[post-name=(.*)\]#","$1",$filter);
//Check if the filter is true or false
if((is_single() || is_page()) && $post_slug == $post->post_name && !is_front_page() && !is_home())
$r = $r || true;
//Return true or false.
return $r;
}
Nicolás Guglielmi nicolas.guglielmi@gmail.com
|
Nicolás Guglielmi nicolas.guglielmi@gmail.com |