How can I get an url-friendly version of the post_title? I´m using anchor links for my posts on an archive page, and for the moment the posts get the post_ID as a hash tag but I would like to get the title instead as it would look nicer.
If you want the short version with "-" between the words use the slug. If you don't want to use the slug use the function bellow:
<?php $new_url = sanitize_title(get_the_title()); echo $new_url; ?>