1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Does anyone knows how to get the post name/slug?

Discussion in 'WordPress' started by dreteh, Mar 2, 2010.

  1. #1
    Hello,

    I know that you can call the_title() to get post title within the loop.
    But is there a function I can call to get the post name or slug? (ex, my-post-name)

    Thank you.
     
    dreteh, Mar 2, 2010 IP
  2. dreteh

    dreteh Member

    Messages:
    514
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    33
    #2
    For people who have the same question.
    Here is what I did:

    global $post;
    $slug = $post->post_name;
     
    dreteh, Mar 3, 2010 IP