Support » Themes and Templates » Not printing permalink in category and front

  • Resolved kjellkk


    Hi there,

    I’ve tried searching for a while now to no avail so I’ll pose my question and hope to be directed to the right answer if it already exists.

    Permalinks are working smooth as.

    I’m wanting to show the permalink on my printerfriendly pages (by CSS) as well as have a link to the Google translation service.

    To do this I’m using the_permalink()

    It works fine on any posts or pages, but for the front, category pages, or tags pages it will just show the permalink for the most recent post or page.

    I thought for a while that I had messed up the theme/template, not closing a loop or something, but tried with another and same problem. I’m still open to the possibility that some plugin might have messed this up, but good to hear from others before I check them all.

    The site in development is at – I’ll go out of development shortly so will make a workaround (not show permalinks on the mentioned pages) if I don’t find a solution.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Adam Brown


    I looked at a print previous of your main page. From where the permalink shows up, I would guess it’s not in a loop at all, right? It needs to be used within the loop to behave as expected.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Right, the_permalink() is a Loop-only function. There are other functions for getting different types of URLs.

    If you just want the current url, there’s no built in function to do that. But this function will do the trick, I think:

    function get_current_url() {
    	return (( isset($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];


    woops – you are right, not in loop. I guess I really should sit down and read more of the documentation.

    Anyway, thanks very much for that function Otto, serves my purpose very well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not printing permalink in category and front’ is closed to new replies.