Get article or page alias (slug) as subheading
Some design drafts, we need to set a paragraph of English as a page sub-title, we can use custom custom to achieve this function, but slightly troublesome. If the WordPress site to use the article alias as a fixed link, we can get the article alias as a subheading to use, but also allows users to intentionally edit the alias, so that the page of the site looks a lot of beautiful.

WordPress does not provide us with a function to get the post alias, we only have to do it themselves, in fact, it is very simple, let's look at the code.
function the_slug() {
$post_data = get_post($post->ID, ARRAY_A); # get_data_of_the_current_post, can be used in a loop or on a single page
$slug = $post_data['post_name']; #post_name is the slug of the post, post_title is the title of the post, don't get confused.
echo ucwords( str_replace("-", " ", $slug) ); # replace the horizontal line in the alias with a space and convert the first letter of the word to uppercase
}
When you need to display the article alias, just call it directly.
the_slug().;
As simple as calling the article title and article content, we can also intercept the first few words in the alias to use as a subheading, as needed.