No worries. You got this sorted?
No, I am still wondering how! 🙂
Ok, no worries.
Yea, you can’t do this with the shortcode because ALM uses the category_name WP_Query parameter which uses OR as you found out.
The only way I can suggest is you try to make use of this filter to modify the query.
function my_cat_listing($args){
$args['category__and'] = array(
array( 2, 6 )
);
return $args;
}
add_filter( 'alm_query_args_{your_alm_ID}', 'my_cat_listing' ); // <- Change this to be your ID
OK, thanks! I will give it a spin later. 🙂
Yes. This is a big feature request for me. Is there any chance that this is coming soon?
@peretz – did you try the example I shared above?
@dcooney – I haven’t. Where exactly do I find the code that needs to be modified?
Thanks.
@peretz – The code I posted is a filter you can use to adjust query params. I also pointed a link to the docs.
Hm, can’t see that the function is doing anything. Still showing pages that only belong to category id 76, i want to load pages that belong to 76 AND 67. The Shortcode looks like this.
[ajax_load_more id="lyxdam" preloaded="true" category="dam,lyx" exclude="47" posts_per_page="5" repeater="default" post_type="page" pause="true" transition="fade" images_loaded="false" button_label="Visa fler" button_loading_label="Laddar..." container_type="div" css_classes="flexbox"]
and the code I added to functions.php
function my_lyxdam_listing($args){
$args['category__and'] = array(
array(76,67)
);
return $args;
}
add_filter( 'alm_query_args_{lyxdam}', 'my_lyxdam_listing' );
What am I doing wrong here? Quotation marks missing anywhere?
Ah, darn wait. There is a category in the shortcode!
@dcooney – okay. I clicked on that link which explains exactly how to do this. And I will give it a try. Thank you for your time!
Nope. It loads all pages in the site now. 😀
[ajax_load_more id="lyxdam" preloaded="true" exclude="47" posts_per_page="5" repeater="default" post_type="page" pause="true" transition="fade" images_loaded="false" button_label="Visa fler" button_loading_label="Laddar..." container_type="div" css_classes="flexbox"]
Ok sorry,
I posted the incorrect filter markup.
I just tested this example and it works.
function my_cat_listing($args){
$args['category__and'] = array( 1, 33 );
return $args;
}
add_filter( 'alm_query_args_12345', 'my_cat_listing' ); // <- Change this to be your ID