• cjyvr

    (@cjyvr)


    Hi all,

    We are just moving out of beta and must change our domain name (bummer) but do not want to loose our thousands of facebook likes.

    HTML code on our page for the likes is as follows:

    <iframe frameborder=”0″ scrolling=”no” allowtransparency=”true” style=”border:none; overflow:hidden; width:50px; height:65px;” src=”http://www.facebook.com/plugins/like.php?href=http://example.com/story1/&layout=box_count&show_faces=true&width=50&action=like&font=arial&colorscheme=light&height=65″&gt;
    </div>

    PHP code (sharebox.php) for likes inside the sharebox wrapper looks like this:

    <div class=”panel” title=”Like on Facebook”>
    <iframe src=”http://www.facebook.com/plugins/like.php?href=&lt;?php echo rawurlencode(get_permalink()); ?>&layout=box_count&show_faces=true&width=50&action=like&font=arial&colorscheme=light&height=65″ scrolling=”no” frameborder=”0″ style=”border:none; overflow:hidden; width:50px; height:65px;” allowTransparency=”true”></iframe>
    </div>

    <?php } ?>

    The href defaults to the current page/permalink normally but I would like to be able to use a wordpress custom field to insert our old page url for articles pre domain switch and revert back to the current permalink for post domain switch posts.

    Can anyone suggest an approach for this? I am not a coder unfortunately.

    Alternatively, if there is another way of doing this that would be great too.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m not sure how sophisticated the FB Like mechanism is. Will it happily return the likes of another website to the iframe if so requested? Or does it check the referer field and throw an error if there’s no match? Or some other verification mechanism?

    If it is the first condition, you can just str_replace your old domain into the new permalink, like so:
    <?php echo str_replace('newdomain', 'olddomain', rawurlencode(get_permalink())); ?>

    You might try a simple manual test first, place the Like iframe html on a webpage of your new domain, but with the old domain passed to facebook as the href url parameter. Confirm facebook sends the Likes belonging to the old doamin without issue.

    Thread Starter cjyvr

    (@cjyvr)

    Thanks bcworkz, probably correct not that not that simple. Will continue my research. Anyone have any thought beyond the below pls chime in.

    http://facebook.stackoverflow.com/questions/7197919/how-can-i-move-a-url-via-301-redirect-and-retain-the-pages-facebook-likes-and-o

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Change Domain But Retain Facebook Likes’ is closed to new replies.