Fix “Smells Like Facebook” theme URL Funkyness

I’ve been using this new “Smells Like Facebook” theme for a few days now, and one annoying problem that it has is munging-up the URL as you browse the site.  As you click around the site, the URLs get a “#” stuck in them, and if you ever click the “Home” link, all links you click after that have not only a stray “#”, but they also have your base-URL doubled-up.  For example, my URL looked like this after clicking around a few pages:

The easy fix for this problem is to disable the “java and AJAX effects” in the theme settings.  The trouble with this though, is that it seems to break the ability for anyone to leave any comments!

After tinkering around a bit, I think I’ve fixed it up by adding two simple lines to SCRIPT.JS.  This will disable java/ajax for everything except the comment sections.

WARNING:: I am not a coder.  I do not know what I am doing.  Before you attempt the changes below, back up your files, your WordPress database, your Microsoft Word Documents and all the porn on your C: drive!  If you find that this ‘fix’ of mine breaks something else, please post a comment here.  I’ve been testing this fix for a few hours and as far as I can tell, it’s working – but I make no guarantees.

Find script.js located in wp-content\themes\smells-like-facebook

Find this section:
$(id + " a").not(".nextpost").not(".notajax").each(function() {
site = $("meta[name='home']").attr("content");
dashboard = $("meta[name='url']").attr("content") + "/wp-admin";
wplogin = $("meta[name='url']").attr("content") + "/wp-login.php";
if (
$(this).attr('href') != '#' && //it's not a '#' only link
$(this).attr('href').indexOf(site) == 0 && //it's an internal link
$(this).attr('href').indexOf(dashboard) == -1 && //it's not a link to dashboard
$(this).attr('href').indexOf(wplogin) == -1 //it's not a link to wp-login.php

Immediately AFTER the line that reads:

dashboard = $(“meta[name=’url’]”).attr(“content”) + “/wp-admin”;

add the following line:

thehome = $(“meta[name=’url’]”).attr(“content”)

Then, immediately AFTER the line that reads:

$(this).attr(‘href’).indexOf(site) == 0 && //it’s an internal link

Add the following line:

$(this).attr(‘href’).indexOf(thehome) == -1 &&

The new section should look like this:

$(id + " a").not(".nextpost").not(".notajax").each(function() {
site = $("meta[name='home']").attr("content");
dashboard = $("meta[name='url']").attr("content") + "/wp-admin";
thehome = $("meta[name='url']").attr("content");
wplogin = $("meta[name='url']").attr("content") + "/wp-login.php";
if (
$(this).attr('href') != '#' && //it's not a '#' only link
$(this).attr('href').indexOf(site) == 0 && //it's an internal link
$(this).attr('href').indexOf(thehome) == -1 &&
$(this).attr('href').indexOf(dashboard) == -1 && //it's not a link to dashboard
$(this).attr('href').indexOf(wplogin) == -1 //it's not a link to wp-login.php

Save the new script.js file back to your server, load up your blog, hit REFRESH or RELOAD to reload the JS, and see if it works any better.  If it does, or if it breaks something else, please leave a comment and let me know.  I know this isn’t the most elegant fix, but hey, it’ll do the job until the theme author comes up with a ‘real’ fix.

Applies to “Smells Like Facebook” Version 2.4

Fix "Smells Like Facebook" theme URL Funkyness by

50 thoughts on “Fix “Smells Like Facebook” theme URL Funkyness

  1. No luck for me. It does fix the navigation, but all my pages’ content disappears. Pages are blank. If I then do disable ajax, content shows up again on pages, but commenting appears impossible.

  2. Ok ok ok, nevermind. It seems when I copy and paste your code, it’s in a different character set. So the quote marks and apostrophes do not show appropriately in my code, therefore, they’re not treated as code…. but I fixed that. It’s working. I’ll let you know if I encounter any glitches, but so far so good!

  3. Thanks, Randy. Your fix appears to be working well on my site. I was also having problems with IE 6, which apparently cannot handle the strange # problem at all – any page with a form on it just did not show up.

    Your fix solved that problem, too. Thanks!

  4. @n0chase – Ok – download the them, activate it, and you’re 99% there! Then, make the changes i’ve posted here in my blog, and you’re pretty much done. Where exactly are you having trouble?

  5. Hey Randy, Im using the layout for a new site in pre alpha at the moment – your fix is GREAT – but my comments on the post pages arent working, although they do work on the category pages.

    both are calling #respond on their respective pages, but the blog post template isnt working – any idea whats happening mate?

    cheers! (by the way, looks like you are now the unofficial support for this template ;-))

  6. @MOGmartin; hmm.. not sure why it’s working for everyone else, and not you.. double-check that you did everything right i guess, and make sure you are using Smells Like Facebook v2.4

  7. Looks like disabling javascript option in theme-options and enabling it again solved the annoying # URL but the error in javascript remains…..

    Great theme! Nice to use it!

  8. Hi randy, tried this on smfb2.4 and wp2.8.6; but unable to make it work. I uploaded the new edited script.js; disable AJAV/Javascript in smfb option; reloaded page — but comment link is still not opening up? **??? not sure what is wrong.

  9. yes i already disabled the JS and AJ but nothing’s happen.Best viewed in mozilla firefox but in IE the dropdownmenu doesnt work..

  10. Helow randy Please help how to solve the dropdown menu in smells like facebook themes.The dropdown menu is not working in IE and the themes is broken.

  11. @Rico – is it broken on just your site, or other sites like mine? iiRC, this might be a limitation in how IE handles javascript – if this is the case, the fix is beyond my capabilites.

  12. Hi randy, thanks for the fix.
    Any idea how to fix the “Show older posts” links that will keep repeating the same url (page/2) if viewed under IE? I noticed this is also seen in yr website if viewed on IE8. rgds

  13. Randy: wow.. i thought i screwed up my css on my site. Browsing yours on IE8, if you click on the + category button, the dropdown menu of cateories is shown on the far left rather !! Duh… ie is *&%$^% (in a good way) hahaha.

  14. Never worked for me… I added those 2 lines of code, and turned off ajax / js effects via WP-Admin, but then comments stopped working completely so reverted back. (WP-2.9.2 & SMFB- 2.4.1).

  15. I used the facebook theme for an internal site and had the same problem. This fix works great!
    Had some troubles at first with the quotation marks being in some strange format when trying a copy paste action. Typing in your two lines of code manually worked great though!

  16. Hi, thanks for posting this fix, but I’m having problems. I added the two lines to the script exactly as you stated below, but then all the content on my site was invisible. I then unchecked “Enable Javascript & AJAX effect (using WordPress jQuery)” and that brought back my content, but now I’m unable to post comments on the blog posts. Any ideas? thanks
    I’m using Firefox.

  17. Hi, just wondering how you edited the js file. Did you just open it in notepad? I attempted to edit it in notepad, but it doesn’t seem to be working. the content on my website disappears. Did you use a special editor? thanks

  18. I dont use Windows (yech!) but any simple text editor like Notepad should work just fine (DONT use Wordpad or MS Word!). I used “Text Edit” on my Mac which is very similar to Notepad. You might want to check/change the “encoding” option that you are using… and, be sure to keep a backup of the original file before futzing with it.

  19. So, I figured out why it wasn’t working. I’ve been using notepad and after making the changes and saving it, the formatting goes out of wack. I downloaded a free javascript editor, made the changes you suggest and everything’s working. thank you

  20. I would really like to know why I am having trouble with getting my comments to display now after all these edits. Brand new install of wordpress, i fixed the quotes deal (encoding).

  21. Hey Randy,

    Have you had any luck in tracking down the source of the javascript errors in this theme? I use it too, and I can’t seem to find the source. I’ve tried the original version, without your fix, and it still occurs, so it’s something inherent in the script.js, I think.

    Not a huge deal, but when IE users visit my (our) sites, they get an error warning in the bottom of their screen.

  22. Thanks for getting back so quick. I’ll post back if I find a solution anywheres. If I can’t find a fix, I might be hunting for a new theme as well…

  23. Hello,

    First of all let me to congratulate you.
    Very clever. I could not because of the ajax has started up the site.
    It would be my question, how can I solve it in a previous note to be open no ajax solution, because it doubled the posts.
    thank you, sincerely friendly, Zoli

  24. Oh!! thank very very much!! I did all what you wrote and everything works perfect! thanks.

    I had problem whith google cache: – it cached site in list, but I cannot see any cached page one. it was not good I think =) I will wait for next index of google bot and hope everythink will good with cache of me pages.

    P.S.: after I did your instruction some little changes have done – when you click on some page for going to another page and next page loading – in this moment there are no visual effect of loading (blue rectangles). I know it is not very important but I like it =)

    Anyhow thank you very much!

Leave a Reply

Your email address will not be published.