Forum

Thread tagged as: Question, Problem

Okay I think I get why my above comment works as the set is called portfolio, is there a way to hard code the set?

Maybe

set => 'portfolio'
Drew McLellan

Drew McLellan 2638 points
Perch Support

'category' => 'portfolio/'.perch_get('cat'),

Hello again may I ask for some help. The developer of the script I was using for my portfolio (Isotope) has made a script to load more beyond a set number of portfolio items. Its a kind of Ajax pagination.

However I cannot get it working, it does not seem to be limiting the display and I think this might be the reason why. The script is this:

<script type="text/javascript">
    var page = 1,
    max_page = 2;
    jQuery(document).ready(function(){
    jQuery("#grid_load_more").click(function(){
    jQuery(".w-loadmore").addClass("loading");
    jQuery.ajax({
    type: "POST",
    url: "/assets/resources/portfolio-ajax.php",
    data: {
    action: "portfolioAjaxPagination",
    columns: "3",
    items: "9",
    style: "type_2",
    align: "left",
    ratio: "1-1",
    with_indents: "",
    meta: "category",
    filters: "yes",
    category: "",
    page: page+1
    },
    success: function(data, textStatus, XMLHttpRequest){
    page++;
    var newItems = jQuery("<div>", {html:data}),
    portfolioList = jQuery(".w-portfolio-list");
    newItems.imagesLoaded(function() {
    newItems.children().each(function(childIndex,child){
    portfolioList.append(jQuery(child)).isotope("appended", jQuery(child), function(){
    blogList.isotope("layout");
    });
    });
    jQuery(".w-loadmore").removeClass("loading");
    if (max_page <= page) {
    jQuery(".w-loadmore").addClass("done");
    }
    });
    },
    error: function(MLHttpRequest, textStatus, errorThrown){
    jQuery(".w-loadmore").removeClass("loading");
    }
    });
    });
    });
</script>

The one thing I have guessed and think might be wrong is the url

url: "/assets/resources/portfolio-ajax.php",

I placed a file in that path but not sure if its needed at all or should be somewhere else. I am not sure if Perch would make it need to point somewhere else?

I know its not strictly a Perch issue, but I wondered if this will work with Perch.

I am not currently using Perch for pagination or limiting items as these will not work with this script. The script is inside the portfolio listing template.

Any help would be very much appreciated (by anyone).

To recap I am using Isotope to filter portfolio items and it cannot work with Perch pagination as the filter only works if all items are called but this AJAX pagination is meant to get round this.

PS There are no script errors showing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You may be better to post a new, concise explanation of your problem. I don't think anyone will want to wade through two pages of back and forth.