Using PHP substr function on the_permalink() in WordPress

My urls for posts in WordPress looks like this: http://localhost:8888/testing/book/yes-vi-testar/

Using the_permalink() would generate http://localhost:8888/testing/book/yes-vi-testar/, but I want to cut the first 34 characters to get a string like “yes-vi-testar”. How do I use php substr in a case like this?

<?php
    $friendlypermalink = substr(the_permalink(), 34);
?>

but that doesn’t work.

Use get_the_permalink() to get the permalink without echoing it.

So,

<?php
    $friendlypermalink = substr(get_the_permalink(), 34);
?>

A lot of of the WordPress function have ‘return’ alternates using get as the operative word. i.e.: get_the_timeget_the_content, etc.

the_title is the only one I believe that doesn’t have this option. For the_title you have to pass two empty parameters (the before and after seperators) and either a true or false … not sure at the moment

the_title("","",true);

Get the URL, time and content in WordPress without displaying it

The URL’s of our posts in WordPress looks like: http://blogbysid.wordpress.com/2013/04/26/creating-google-oauth-api-keys-and-developer-key/

Using the_permalink() would generate the link but if you want to get the link only and don’t want it to get displayed, what should we do ?

A lot of of the WordPress function have ‘return’ alternates using get as the operative word.

get_the_permalink() - To get the link
get_the_time() - To get the time
get_the_content() - To get the content