• Resolved johaan89

    (@johaan89)


    Trying to wrap my head around the filters with custom WP-queries that get passed onto the shortcode https://connekthq.com/plugins/ajax-load-more/examples/filtering/

    My shortcode looks like this

    
    [ajax_load_more repeater="default" posts_per_page="12" container_type="div" post__in="'.  implode(',',  $postidsfromquery->posts) .'" orderby="post__in" button_label="Load More "]
    

    However data-attributes don’t work with the post__in=”‘. implode(‘,’, $price2->posts) .'” part since it has double slash,

    I’m i going about this the wrong way and is there a better way to achieve this?

    • This topic was modified 6 years, 2 months ago by johaan89.
    • This topic was modified 6 years, 2 months ago by johaan89.
    • This topic was modified 6 years, 2 months ago by johaan89.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @johaan89,
    Interesting. I don’t think I have ever tested with the post__in parameter.

    Did you try data-post--in="" as your data attribute?

    Let me know.

    Thread Starter johaan89

    (@johaan89)

    hmmm I should have tested normal post ID’s too. Yeah that does work when you input the raw ID’s

    
    data-post--in="2678"
    

    <—– this works

    
    data-post--in="'.  implode(',',  $postidsfromquery->posts) .'"
    

    <—— this doesn’t

    (disclaimer im still learning PHP so I might be doing something facepalm worthy haha)

    • This reply was modified 6 years, 2 months ago by johaan89.
    • This reply was modified 6 years, 2 months ago by johaan89.
    • This reply was modified 6 years, 2 months ago by johaan89.
    • This reply was modified 6 years, 2 months ago by johaan89.
    Thread Starter johaan89

    (@johaan89)

    hmmmm, should have tinkered around more before making this question. I just echoed the variable inside the data-post-in to get the ID’s, though i can see this getting the html messy if you have hundreds of posts ID’s being called.

    • This reply was modified 6 years, 2 months ago by johaan89.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filtering with data-attributes question’ is closed to new replies.