WordPress.org

Support

Support » How-To and Troubleshooting » get full URL, not permalink

get full URL, not permalink

  • hi,

    i’m using FB “like button” code below but need to get the full, exact page URL that’s in the browser URL window, not the permalink, post or page ID.

    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px;"></iframe>

    does anyone know what I would use to replace the following code snippet from above so it grabs the exact, full page URL and not the permalink?

    <?php echo urlencode(get_permalink($post->ID)); ?>

    Thanks!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    @esmi

    Forum Moderator

    The permalink is the full, exact page URL that’s in the browser URL window.

    thanks for responding, let me try to be clearer.

    I’m using an ecard plugin (wpgreet) in conjunction with nextgen gallery plugin for an ecard site that creates URLs like this…

    http://subdomain.domain.com/send-ecard/?gallery=8&image=http://subdomain.domain.com/wp-content/gallery/work/work_sorry-you-were-replaced.png

    …for the pages showing the individual ecards. Facebook and twitter sharing is working from those pages (sending people back to the correct URL), but every “Like Button” plugin or code i try sends people back to this URL…

    http://subdomain.domain.com/send-ecard/

    …cutting off the whole back part of the URL. I guess my terminology was wrong, but when I use the code above it does not send people back to the full URL.

    Hope this is clear. Thanks!!

    esmi

    @esmi

    Forum Moderator

    You’d need to hack one of the Like plugins to grab the url query string. Never tried that within WP but elsewhere, I’d probably be looking at $_SERVER['QUERY_STRING'].

    i really appreciate your suggestion, but i’m not a programmer so not really sure where to begin with that. i was hoping that i could use the Facebook like code above and somehow change the part in the code (below) that grabs the permalink to grab the url query string. is that possible? if not, is it possible for you to tell me where i might look in a plugin?

    <?php echo urlencode(get_permalink($post->ID)); ?>
    esmi

    @esmi

    Forum Moderator

    The code you posted above doesn’t include a query string (the bits after the basic permalink that you want). So it’s just not that simple.

    so there’s no way to tweak the code above to include the query string? any other suggestions you might have would be greatly appreciated.

    anyone else have ideas for this?

    i’m surprised that the issue of the facebook like button truncating links with query strings isn’t a more common problem. can’t find a solution anywhere on the web…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘get full URL, not permalink’ is closed to new replies.
Skip to toolbar