public function test_slug() { $this->assertEquals('hello-world', Str::slug('hello world')); $this->assertEquals('hello-world', wpdevsclub_slug('Hello World')); $this->assertEquals('hello-world', Str::slug('hello-world')); $this->assertEquals('hello-world', wpdevsclub_slug('hello_world')); $this->assertEquals('hello_world', Str::slug('hello_world', '_')); }
/** * Generate a URL friendly "slug" from a given string. * * @param string $title * @param string $separator * @return string */ function wpdevsclub_slug($title, $separator = '-') { return Str::slug($title, $separator); }