Grow your CSS skills. Land your dream job.

AJAX and WordPress: How to change Page title

  • # September 8, 2011 at 4:12 pm

    Post title pretty much sums it up. I’m using Chris’ All AJAX theme for wordpress, and I noticed the title doesn’t change and was wondering what’s the best way to change it as well.

    Also, due to the nature of AJAX and SEO, can anyone recommend any articles that relate to both subjects that covers best SEO practices for AJAX websites?

    # July 26, 2012 at 6:59 am

    Hey Noah, I’m also using that AJAX theme and I came up with a way to change the page title. I started by putting this just after my “#main” div that is loaded for each page. You need to put this in all your template files that will be loaded -


    Then in my JS in the footer within the .load function somewhere, I put this -


    var pageTitle = jQuery("input.page-title").val();

    if (!(jQuery.browser.msie)) {
    jQuery('title').html(pageTitle);
    }

    It seems to break in IE so thats why I had the “if” statement in there.

    In terms of SEO. I would recommend adding a Google Sitemap to the site. Google will at least then pick up all the different pages, and luckily with the way that Chris’s theme works, if you click on the page it will take you to the correct AJAX page with the hashlink etc.

    Cheers,

    Dave

    # July 26, 2012 at 7:09 am

    K so if you use -

    document.title = pageTitle

    instead of -


    if (!(jQuery.browser.msie)) {
    jQuery('title').html(pageTitle);
    }

    it works in IE too.

    Cheers!

    # August 26, 2012 at 7:57 am

    Hi

    I’m new to jquery… please can you give me the full jquery code that will go between the script tags for this to work?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".