WordPress.org

Ready to get started?Download WordPress

Forums

get full URL, not permalink (8 posts)

  1. xiabolai
    Member
    Posted 3 years ago #

    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!!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

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

  3. xiabolai
    Member
    Posted 3 years ago #

    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!!

  4. esmi
    Forum Moderator
    Posted 3 years ago #

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

  5. xiabolai
    Member
    Posted 3 years ago #

    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)); ?>
  6. esmi
    Forum Moderator
    Posted 3 years ago #

    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.

  7. xiabolai
    Member
    Posted 3 years ago #

    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.

  8. xiabolai
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags