• Since the ‘<body>’ tag is mostly going to be outside the content that gets refreshed with this plugin, the classes placed on the body tag with ‘body_class()’ aren’t being refreshed either.

    This is a fairly large issue for a lot of themes, since using these classes intelligently is key to writing efficient CSS with WordPress. For one, it’s fairly certain to cause issues with WooCommerce, but a lot of other themes are going to exhibit oddities as well.

    I’m seriously considering purchasing/donating for this plugin, since it’s generally a very nice piece of work, but this particular issue has me hesitating, since it’s rather vital to my theme development that I can use those classes.

    Is it possible to create a fix and roll it into the plugin code? From browsing, there appears to be quite a few who are stumbling on this problem. (Though some might not be aware that this is the issue.)

    Kind regards,

    https://wordpress.org/plugins/advanced-ajax-page-loader/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Until the latest update this didn’t seem to be an issue, but now I’m having the exact problem you’re describing.

    This almost completely breaks my site as after a few page loads, the plugin interferes with ALL hyperlinks on the site, meaning our readers cannot click ANYTHING at all.

    Please update the plugin to fix this problem!!!

    Plugin Author Dean Williams

    (@deano1987)

    okay wrecknoble please can I have a link to your site and steps to reproduce, wireframed I think your issue is different from wrecknoble. Basically its the feature of AJAX that things will not be changed even if they changed previously, nor will any javascript events be fired which is why there is such things as reload codes.

    However, if you set AAPL to reload on the <HTML> tag it might just update the classes you require, please try it.
    Otherwise a reload code will need to be created for your specific requirements, this isnt something to *fix* as it is not a bug and is unavoidable.

    Hi Dean,

    I would like to know if it’s hard to create a reload code that just reloads the CSS Code for the body tag.
    I would like to change the background colors of the pages for example, so it would be really great to be able to do this.

    Thanks alot,
    Stefan

    physalis

    (@physalis)

    Hi there,

    is there an update on the body class thingy? Was anybody getting successful in changing the body class when ‘loading’ a new page?

    Thanks in advance

    physalis

    slr1979

    (@slr1979)

    Has anyone figured out a fix for this as yet?

    I am also very interested in this as I am using theme that has many different layouts and exhibits the same issues discussed in this thread.

    As wireframed correctly stated

    This is a fairly large issue for a lot of themes, since using these classes intelligently is key to writing efficient CSS with WordPress.

    I think a resolution to this would be advantageous to the author of AAPL as many people want their dynamic layouts to work in harmony with AAPL.

    Is there any chance the developer would like to include this feature as standard? Although I already think AAPL is a brilliant plugin, a fix for this would definitely persuade me to purchase/donate when my development is finished. Without a fix for this my site will not be as fully functional as it could be and this does limit the potential of the AAPL plugin. Good examples on live sites of this plugins use could only benefit the developer in the future;-)

    Any help/input would be appreciated.
    Kind Regards

    Thread Starter wireframed

    (@wireframed)

    For some reason I didn’t get nofitications about updates here until now. :-/

    okay wrecknoble please can I have a link to your site and steps to reproduce, wireframed I think your issue is different from wrecknoble. Basically its the feature of AJAX that things will not be changed even if they changed previously, nor will any javascript events be fired which is why there is such things as reload codes.

    However, if you set AAPL to reload on the <HTML> tag it might just update the classes you require, please try it.
    Otherwise a reload code will need to be created for your specific requirements, this isnt something to *fix* as it is not a bug and is unavoidable.

    It’s not that I don’t understand the issue. 🙂 However, reloading everything in <html> kinda defeats the point of using AJAX, since you’re essentially reloading the entire page anyway. A more elegant solution would be using Javascript to inject updated <body> classes dynamically when you’re grabbing the content anyway. Particularly since WP trains you to use the <body> classes for at lot of stuff.

    It’s not an insurmountable problem, but it DOES limit the plugin, which is otherwise very nice.

    Regards,

    I just worked out a solution for this.

    Inside the success function around line 178 I added this.

    var matches = data.match(/<body.*class=["']([^"']*)["'].*>/),
        classes = matches && matches[1];
    jQuery("body").removeClass().addClass(classes);

    Which gets all of the classes from the body tag of the page to be loaded. Then removes all of the classes from the body tag from the visible page and then adds in all of the classes from the page to be loaded. I have seen a few other topics in the forum fro this which are closed. I hope this reaches people who have been looking for this.

    Jesse

    Jesse, you are my hero for posting that code.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Update body classes’ is closed to new replies.