WordPress.org

Ready to get started?Download WordPress

Forums

Facebook Likes counts, from 100 to 0 after moving WP (21 posts)

  1. MPESGT01
    Member
    Posted 8 months ago #

    I have a website with many news. Lots of them have good Facebook Likes numbers (up to 100 likes for some articles and galleries)
    After moving wordpress form "/news" to "/" (root), and doing an htaccess 301 rewrite redirect : all the facebook likes are at 0 !! (except the new artciles I am adding to the site)

    After 4 hours... I have done many search on the web. I have done many tryal-errors in the code lines... just can't seem to get a code that will tell Facebook to use my old url

    MY OLD CODE LINE that was working before is move

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

    MY NEW CODE LINE, working, but not as I want to

    <div class="fb-like" data-href="<?php echo get_permalink(); ?>" data-width="100" data-layout="button_count" data-show-faces="false" data-send="false"></div>

    ...remember that "/news" is the old location

    ?? IN PHP, HOW TO tell my wordpress code line to show exactly http://www.mysite.com/news/post-title

    I have try many variation like these, but their results are not working okay

    http://www.mysite.com/news/<?php echo urlencode(($post->ID)); ?>
    <?php echo urlencode(get_permalink('/news/')($post->ID)); ?>
  2. Mike
    Member
    Posted 8 months ago #

    So you used to have all you WordPress files in:

    WordPress Address (URL): http://www.mysite.com/news/

    Your Site Address (URL) was http://www.mysite.com/news/

    You moved the WordPress files out of the news folder into the root.

    Which means you changed
    WordPress Address (URL): http://www.mysite.com/

    Is this correct?

  3. MPESGT01
    Member
    Posted 8 months ago #

    Hello Mike
    this is correct.
    "mysite.com/news" was where all WP files were... and now they're all in the root folder, one step behind, in "mysite.com/"

  4. Mike
    Member
    Posted 8 months ago #

    If facebook worked before, would it not work to change Your Site Address (URL) back to http://www.mysite.com/news/ ?

  5. MPESGT01
    Member
    Posted 8 months ago #

    and how can I do it ?
    see above my 1st old line of code use a php string getting the "present" complete pretty url. Which can't be use if I want to tell Facebook that this url still have "/news" in it...

  6. Mike
    Member
    Posted 8 months ago #

    What is the url to your site?

  7. MPESGT01
    Member
    Posted 8 months ago #

    ... so that is why I am guessing I need to find a way to insert in a php string the missing part, the "/news"

  8. MPESGT01
    Member
    Posted 8 months ago #

    snowboardquebec.com (see first index page)

  9. Mike
    Member
    Posted 8 months ago #

    ok, now an url to one page that you want to add news to

  10. MPESGT01
    Member
    Posted 8 months ago #

    here is a single page
    http://www.snowboardquebec.com/2013/toots-et-reid-senvoient-en-lair/
    (but keep in mind that my main challenge, i guess, is to do it on the index page)
    (and this single page still need facebook code work to be done, lol)
    thanks.

  11. Mike
    Member
    Posted 8 months ago #

  12. MPESGT01
    Member
    Posted 8 months ago #

    no. the %year% still exist, no structure were change. only a move was done.
    so before it was
    http://www.snowboardquebec.com/news/2013/toots-et-reid-senvoient-en-lair/
    and now it's
    http://www.snowboardquebec.com/2013/toots-et-reid-senvoient-en-lair/

  13. Mike
    Member
    Posted 8 months ago #

    ok.

    So if you change your permalinkstructure to:

    /news/%year%/%postname%/

    you should have your original links back?

  14. MPESGT01
    Member
    Posted 8 months ago #

    Good. But i do not want to change my site urls. Only what Facebook sees

  15. Mike
    Member
    Posted 8 months ago #

    I don't think you can do that.

  16. MPESGT01
    Member
    Posted 8 months ago #

    Isnt there a way of simply adding text inside a PHP string ???

  17. Mike
    Member
    Posted 8 months ago #

    this will truncate your permalink:

    http://wordpress.org/support/topic/permalinks-without-domain-part?replies=2

    Then you can add yourdomain.com/news

    good luck!

  18. MPESGT01
    Member
    Posted 8 months ago #

    Hum. I will try to play with this. If it works i Will say it here.
    Otherwise other experts are welcome to help

  19. Mike
    Member
    Posted 8 months ago #

    you're welcome

  20. MPESGT01
    Member
    Posted 8 months ago #

    Thanks again :-)

  21. MPESGT01
    Member
    Posted 8 months ago #

    okay... I have play with this line of code and no it does not work. So back at the start again...

    Anybody knows a way to insert this: "/news"
    into this: <?php echo get_permalink(); ?>
    which gives: http://www.mysite.com/2013/toots-et-reid-senvoient-en-lair/
    but what i want it to appear, just in one place, is: http://www.mysite.com/news/2013/toots-et-reid-senvoient-en-lair/

    because I want to trick/hack Facebook Likes button count so that I will count my previous pages again. Help!

Reply

You must log in to post.

About this Topic