Habari\Posts::rewrite_match_type PHP Method

rewrite_match_type() public static method

Check if the requested post is of the type specified, to see if a rewrite rule matches.
public static rewrite_match_type ( RewriteRule $rule, string $stub, array $parameters ) : boolean
$rule RewriteRule The rewrite rule we're matching against
$stub string The URL stub request that triggered the rule
$parameters array The included parameters on this rule
return boolean Whether the requested post matches the content type of the rule.
    public static function rewrite_match_type($rule, $stub, $parameters)
    {
        $args = $rule->named_arg_values;
        $args['count'] = true;
        $postcount = Posts::get($args);
        return $postcount > 0;
    }