Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating a slug from a string or title for part of link url


  • gingram815
    Member

    @gingram815

    I am trying to create a link in the membership directory under each person’s name.
    You can see what I have so far at http://transylvaniawellnessalliance.com/members/.

    I did this by putting this code into the members-loop.php file.
    `

    `

    This grabs the name of the member’s profession from their profile data and uses is to create a link to a page that describes that profession. This works great except for one small problem:

    When the profession has 2 names such as “Naturopathic Doctor,” I need to turn this into a slug so that the link works. I have tried using the “sanitize_title_with_dashes()” function but it kept returning empty or doing nothing.

    How can I get the “Naturopathic Doctor” to read “naturopathic-doctor” inside the link?

    Thank you for any help,
    Glenn

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating a slug from a string or title for part of link url’ is closed to new replies.
Skip to toolbar