• 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="https://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)
  • The permalink is the full, exact page URL that’s in the browser URL window.

    Thread Starter xiabolai

    (@xiabolai)

    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…

    https://subdomain.domain.com/send-ecard/?gallery=8&image=https://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…

    https://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!!

    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'].

    Thread Starter xiabolai

    (@xiabolai)

    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)); ?>

    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.

    Thread Starter xiabolai

    (@xiabolai)

    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.

    Thread Starter xiabolai

    (@xiabolai)

    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.