Forums

Get permalink by post title (3 posts)

  1. leafmealone
    Member
    Posted 3 years ago #

    My question is very simple:

    Looking to get the permalink of a post using it's title. Basically trying to accomplish something that would work like "get_permalink('Title of Post')".

    When I use "get_permalink('100')", for example, all it does is output http://www.mysite.com/?p=100, which is especially worthless since I'm using pretty permalinks.

    The reason I can't just put the link into the post directly is because it will be supplied conditionally by a custom meta field.

    Any thoughts?

  2. thisismyurl
    Member
    Posted 3 years ago #

    If I understand what you're looking for correctly, <?php echo $post->post_name; ?> should do it.

  3. leafmealone
    Member
    Posted 3 years ago #

    Thanks for the reply. My fault, I should have been more specific:

    The call I want to make will be within a post's loop but in reference to another post in a different category.

    The exact situation is that I have a post in a "Shows" category containing an upcoming event's details. One of those details I would like to be a link to a post in a "Venues" category, that has the venue's address, a google map API, and other details about the venue.

    I probably have to do another Query...but I'm not sure how to accomplish this.

Topic Closed

This topic has been closed to new replies.

About this Topic