Creating a slug from a string or title for part of link url
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.
`<a id="profession" href="http://transylvaniawellnessalliance.com/wellness-businesses/“>
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,
- The topic ‘Creating a slug from a string or title for part of link url’ is closed to new replies.