I developed a widget for Wordpress to show the portfolio, the user can choose whether he wants pagination, filter categories, number of posts per page ... etc., it works fine with php pagination system, I have done .
I am trying to implement ajax jquery for this pagination in widgets to reload it without reloading the whole page. I have this code:
jQuery('.paginate a').live('click', function(e){ e.preventDefault(); var link = jQuery(this).attr('href'); jQuery('.widget_gantry_portfolio').html('<div class="loading"></div>'); jQuery('.widget_gantry_portfolio').load(link+' .widget_gantry_portfolio .portfolio_class');
Paging works fine in php when I implement this code and pages, but when I click the widget will lose all user settings (show filter, show pagination..etc), divs will also lose their calculated% width and height, which was first introduced in css (see firebug ):
element.style{width and height}
I had several days around this and it turned out instead of live, on and delegate , etc., but none of them work, this pagination ajax also works fine in paginated sections on mine but the widget does not reload elements Dom?
The most important thing for me:
- Each element that is not in width and height that was in the DOM css, firstly, this width is calculated using the .php enqued script function, which goes like this, for example, when it has 4 columns:
var mysizes = function() { theWidth4 = jQuery(".mosaic-block4c img").css('width'); jQuery(".mosaic-block4c").css('width', theWidth4); theHeight4 = jQuery(".mosaic-block4c img").css('height'); jQuery(".mosaic-block4c").css('height', theHeight4); }
I call mysizes (); function from php widget with tag
- Filter categories that are missing, I think, because when loading the page it does not recognize user presets for the widget. It recognizes it perfectly on the first page, but not on subsequent pages.
The link to the site by page portfolio widget is not working properly (please click 2 pages to see):
http://framecero.com/aagantrywordpress/?page_id=635
Link to an example category with the same page work (pagination at the bottom of the page):
http://framecero.com/aagantrywordpress/?cat=4