Return to Snippet

Revision: 58862
at August 7, 2012 10:04 by Farhan


Initial Code
// Put in Functions.php

function the_slug() {
$post_data = get_post($post->ID, ARRAY_A);
$slug = $post_data['post_name'];
return $slug; }

// Put where you want to show in page or single etc. Use for custom class for each page

<?php echo the_slug(); ?>

Initial URL


Initial Description
Function to get wordpress post/page slug to be used on for custom class etc

Initial Title
Get WP Page Slug

Initial Tags
page, wordpress

Initial Language
PHP