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:

http://success.grownupgeek.com/#/index.php/2009/07/page/http://success.grownupgeek.com

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
  • http://www.cozbaldwin.com Coz

    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.

  • http://www.cozbaldwin.com Coz

    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!

  • http://fabulouspdx.com Rob Patton

    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!

  • http://fabulouspdx.com Rob Patton

    Oh…your fix also made it so permalinks work! Thanks again!

  • http://anotherstoryfromme.com/ xander

    nice facebook site

  • http://www.meetandnetwork.com n0chase

    i really would like to activate the FB theme to my site could you help me please the 3 column is what i need

  • http://success.grownupgeek.com Rand B. Wilson

    @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?

  • http://fuzzyseo.com MOGmartin

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

  • http://success.grownupgeek.com Rand B. Wilson

    @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
    ??

  • Anonymous

    This worked great… thx

  • http://fuzzyseo.com MOGmartin

    will check through it all again mate and let you know if it resolves it, or if I need to change any code I will post it up…

    cheers!

  • http://vakantie-in-ameland.nl Marcel

    Even with the fix I get this error in the error console. And the annoying # in the url. Anyone an idea?

    Error: $(“textarea”).not(“.respondtext”).autogrow is not a function
    Source File: http://www.vakantie-in-ameland.nl/wp-content/themes/smells-like-facebook/script.js?ver
    Line: 133

  • http://vakantie-in-ameland.nl Marcel

    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!

  • af3

    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.

  • http://success.grownupgeek.com Rand B. Wilson

    @AF3 – huh.. i dunno.. double check that you made the changes correctly be sure to clear your browser cache and try clearing your blog cache and try again.

  • http://www.maggiethedog.com soner Kay

    Great! Thanks. I’ve been pulling my hair out over this one all afternoon. The fix works great. Keep up the good work.

  • Blackito

    Thank you very much for this fix… The fix works great. good job..

  • Rico

    The theme broke in Internet Explorer browser?How can i can fix it?Please help!

  • Rico

    the menu dropdown didn’t work in IE how can i fix this bug’ssss..help

  • http://success.grownupgeek.com Rand B. Wilson

    @Rico – I’m not sure how much help i can give – but, have you tried disabling the JavaScript and Ajax in the Smells Like Facebook Theme Settings?

  • Rico

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

  • Rico

    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.

  • http://success.grownupgeek.com Rand B. Wilson

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

  • Rico

    Tnx randy..

  • af3

    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

  • http://success.grownupgeek.com Rand B. Wilson

    @AF3 – I’m afraid that issue is over my head.

  • http://www.budakhitam.com Syahid

    howdy pals! can you teach me on how to remove the login button at the header?

  • af3

    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.

  • Tom

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

  • http://www.apptv.se Calle

    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!

  • http://www.malgordon.com Mal Gordon

    Works fine, thanks Randy!

  • Debra

    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.

  • Tom

    That’s exactly what happened with me Debra. No fix so far im afraid.

  • Debra

    That’s unfortunate; it’s such a nice looking theme.

  • http://tpporganization.co.cc MC

    Thanx man ..It’s working fine for me..

  • ds1970

    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

  • http://success.grownupgeek.com Rand B. Wilson

    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.

  • ds1970

    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

  • http://dachiliheads.net76.net/ DaChiliHeads

    Woo hoo cheers! just the thing I needed!

  • Steve

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

  • http://success.grownupgeek.com Rand B. Wilson

    I dunno Steve .. Try reverting the edits and verify that your comments display. Then, redo the edits manually and see if that helps.

  • Stefan

    Really thank you!

  • Gob

    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.

  • http://success.grownupgeek.com Rand B. Wilson

    @Gob; no luck – it’s over my head (i’m no programmer!).. i’ve been considering changing to a new theme anyway..

  • Gob

    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…

  • http://www.reflexzion.com Julio Pineda

    Really…Thanks man! I was going nuts over this…

  • http://Hirbook.hu stux

    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

  • http://buyaroff.com/ Buyaroff

    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!

  • http://www.adrianfilip.com Adrian

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

    To

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

    Works for me ;)