WordPress permalink without domain name

OK it might sound stange but I am facing a good challenge with wordpress.
when echoing the_permalink(); and checking the portfolio pages, I am getting a link something like this:

http://www.domain.com/?portfolio=test 

(Where test is the portfolio name).

Read More

Is there any option to return the permalink trimmed to ?portfolio=test keeping out the domain url?
While asking, I think I got the answer already (trim()) but I would like to hear your ideas too.

every answer will be much appreciated!

Related posts

Leave a Reply

1 comment

  1. You can obtain the permalink of a post by doing something like so:

    <?php 
        function my_permalink() {
            echo substr(get_permalink(), strlen(get_option('home')));
        }
    ?>
    

    The get_option method replaces the deprecated get_settings method, and allows you to retrieve named option values from the database:

    http://codex.wordpress.org/Function_Reference/get_option

    The ‘home’ value passed in to the get_option method will return the site URL.