The given PHP example is a function to get wordpress post/page slug to be used on for custom class etc. Code Example:
<?php // Put in Functions.php function the_slug(){ $post_data = get_post($post->ID, ARRAY_A); $slug = $post_data['post_name']; return $slug; } ?> <?php // Put where you want to show in page or single etc. Use for custom class for each page echo the_slug(); ?>