Page slug template tag? (4 posts)

  1. Bonnie
    Posted 9 years ago #

    Is there a template tag to display the page slug? If not, does anyone know of a workaround to get one? I tried a few things but none of them worked.

    I'm using WordPress to manage a downloads section on my site, and I'd like to name each of the downloads "page-slug.zip" (where page-slug is the actual page's slug) and then call them up through the template. (Each download has its own page.) So far, using <?php the_ID(); ?> is the only thing that works, but that results in my having to name my zip files 435.zip, etc. which isn't ideal.

    Any ideas? Thanks in advance! :)

  2. Bonnie
    Posted 9 years ago #

    I was searching the forums for "post slug" instead of "page slug". Oops. Found my answer:

    <?php echo $post->post_name; ?>

  3. greatbig47
    Posted 9 years ago #

    This helped me! THANK YOU!!!!

  4. grungepuppy
    Posted 8 years ago #

    this helped me as well. thanks! it was just what i was looking for!

Topic Closed

This topic has been closed to new replies.

About this Topic