Change displayed product number
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from conradude on October 16, 2024, 12:11Hello,
I'm currently using two snippets that work with my current filter plugin (and others)
displaying a "show all" button after the pagination when products number is over 12
add_action( 'woocommerce_after_shop_loop', 'wpse333192_add_showall', 40 );
function wpse333192_add_showall() {
if(!is_admin()) {
if ( ! isset( $_GET['showall'] ) ) {
global $wp;global $wp_query;
if($wp_query->found_posts >= 12){
echo sprintf(
"<a class=\"show-all\" href='%s'>%s</a>",
home_url( add_query_arg( array_merge( $_GET, [ 'showall' => 1 ] ), $wp->request ) ),
__( 'Show All','snippet')
);
}
}
}}
and
displaying all the products of the current query if that button's been clicked
function wpse333192_alter_query_showall( $query ) { /** * Alter the query only if it is: * 1. The main query * 2. Post type is product * 3. $_GET['showall'] is set * 4. $_GET['showall'] equals 1 */ if ( $query->is_main_query() && $query->get( 'post_type' ) == 'product' && isset( $_GET['showall'] ) && $_GET['showall'] == 1 && !is_admin() ) { // Load the 'first' page $query->set( 'paged', 1 ); // Set post per page to unlimited $query->set( 'posts_per_page', - 1 ); } return $query; }
My question is : how can I make these snippets work with Husky ? Right now, when I try, the button doesn't appear and adding showall=1 into the url as parameter doesn't work either.
Thank you
Hello,
I'm currently using two snippets that work with my current filter plugin (and others)
displaying a"show all" button after the pagination when products number is over 12
add_action( 'woocommerce_after_shop_loop', 'wpse333192_add_showall', 40 );
function wpse333192_add_showall() {
if(!is_admin()) {
if ( ! isset( $_GET['showall'] ) ) {
global $wp;global $wp_query;
if($wp_query->found_posts >= 12){
echo sprintf(
"<a class=\"show-all\" href='%s'>%s</a>",
home_url( add_query_arg( array_merge( $_GET, [ 'showall' => 1 ] ), $wp->request ) ),
__( 'Show All','snippet')
);
}
}
}}
and
displaying all the products of the current query if that button's been clicked
function wpse333192_alter_query_showall( $query ) {
/**
* Alter the query only if it is:
* 1. The main query
* 2. Post type is product
* 3. $_GET['showall'] is set
* 4. $_GET['showall'] equals 1
*/
if ( $query->is_main_query()
&& $query->get( 'post_type' ) == 'product'
&& isset( $_GET['showall'] )
&& $_GET['showall'] == 1
&& !is_admin()
) {
// Load the 'first' page
$query->set( 'paged', 1 );
// Set post per page to unlimited
$query->set( 'posts_per_page', - 1 );
}
return $query;
}
My question is : how can I make these snippets work with Husky ? Right now, when I try, the button doesn't appear and adding showall=1 into the url as parameter doesn't work either.
Thank you
Quote from Pablo Borysenco on October 17, 2024, 09:53Hello
Please drop me exact link to the issue
wpse333192_alter_query_showall - Which hook is this function for?
Hello
Please drop me exact link to the issue
wpse333192_alter_query_showall - Which hook is this function for?
Quote from conradude on October 17, 2024, 10:41Hello,
sorry, the function is called with this hook : add_action( 'pre_get_posts', 'wpse333192_alter_query_showall' );
You can see the link here :
[spoiler]
- without the showall=1 : https://www.amigosskateshop.com/shop-copy/
- with the showall=1 : https://www.amigosskateshop.com/shop-copy/?showall=1
- working example : https://www.amigosskateshop.com/shop/?showall=1 careful it takes time to load (and without the showall=1 so you can see the link appearing at the bottom https://www.amigosskateshop.com/shop/ )
[/spoiler]
Hello,
sorry, the function is called with this hook : add_action( 'pre_get_posts', 'wpse333192_alter_query_showall' );
You can see the link here :
- without the showall=1 : https://www.amigosskateshop.com/shop-copy/
- with the showall=1 : https://www.amigosskateshop.com/shop-copy/?showall=1
- working example : https://www.amigosskateshop.com/shop/?showall=1 careful it takes time to load (and without the showall=1 so you can see the link appearing at the bottom https://www.amigosskateshop.com/shop/ )
Quote from Pablo Borysenco on October 17, 2024, 11:59Unfortunately I don't see any relation to my plugin.
You should write to support this third party product template - https://share.pluginus.net/image/i20241017125917.png
Unfortunately I don't see any relation to my plugin.
You should write to support this third party product template - https://share.pluginus.net/image/i20241017125917.png
Quote from conradude on October 17, 2024, 12:04Hello, sorry about that. That was a bug it has been fixed.
But you just say "I don't see any relation to my plugin" like that even if that's working with other filter plugins but yours ?Would there be a snippet going with your plugin to display all the products when asked ?
Hello, sorry about that. That was a bug it has been fixed.
But you just say"I don't see any relation to my plugin" like that even if that's working with other filter plugins but yours ?
Would there be a snippet going with your plugin to display all the products when asked ?
Quote from Pablo Borysenco on October 18, 2024, 10:00Hello
Our plugin does not affect pagination because it is a filtering plugin.
like that even if that's working with other filter plugins but yours ? - You can simply disable my plugin and nothing will change, your custom code will also not work for this product template
Hello
Our plugin does not affect pagination because it is a filtering plugin.
like that even if that's working with other filter plugins but yours ? - You can simply disable my plugin and nothing will change, your custom code will also not work for this product template
Quote from conradude on October 18, 2024, 10:32Hello,
But what about this options then ?
And, my snippt works on every pages with or without filter plugin except the page with HUSKY plugin. That might mean that the plugins has an impact on this, doesn't it ?
Hello,
But what about this options then ?

And, my snippt works on every pages with or without filter plugin except the page with HUSKY plugin. That might mean that the plugins has an impact on this, doesn't it ?
Quote from Pablo Borysenco on October 18, 2024, 12:36No! Since there is no filtering, the plugin does not affect
This setting is only for Ajax result or [woof_products] shortcode
No! Since there is no filtering, the plugin does not affect
This setting is only for Ajax result or [woof_products] shortcode
Quote from conradude on October 18, 2024, 13:02Oh ok. Do you have an idea that would help me figure it out ?
Cause, 'woocommerce_after_shop_loop' is just a hook to display thing after the loop, nothing really connected to the pagination itself.
And 'pre_get_posts' is related to the query that get posts. Does the plugin use this hook ? I guess yes since it has to filter the query.
Only when I use the plugin, these don't work. I really thing there's something there, don't you think ?
Oh ok. Do you have an idea that would help me figure it out ?
Cause, 'woocommerce_after_shop_loop' is just a hook to display thing after the loop, nothing really connected to the pagination itself.
And 'pre_get_posts' is related to the query that get posts. Does the plugin use this hook ? I guess yes since it has to filter the query.
Only when I use the plugin, these don't work. I really thing there's something there, don't you think ?
Quote from Pablo Borysenco on October 21, 2024, 11:59Hello
I already wrote you my proposal - https://share.pluginus.net/image/i20241021125757.png - Because this third party template may not have these hooks and override 'pre_get_posts'
Hello
I already wrote you my proposal - https://share.pluginus.net/image/i20241021125757.png - Because this third party template may not have these hooks and override 'pre_get_posts'
Quote from conradude on October 21, 2024, 14:37Hello,
Sorry I thought this was meant for the bug at the moment.
The third party template have the hooks and as I said, it works with others filtering plugins. That's why I think it comes from yours.
The function is called by this hook, is there a way to take the plugin into account in this function ?
Thanks
Hello,
Sorry I thought this was meant for the bug at the moment.
The third party template have the hooks and as I said, it works with others filtering plugins. That's why I think it comes from yours.
The function is called by this hook, is there a way to take the plugin into account in this function ?
Thanks
Quote from Pablo Borysenco on October 22, 2024, 11:45Hello
Ok! Just turn off my plugin and do a test
Hello
Ok! Just turn off my plugin and do a test
Quote from conradude on October 22, 2024, 12:09Thank you so much ! That was exactly the help I needed. Indeed you're right and I was wrong! It doesn't work on this page even without the plugin.
I'll have a look on that. I'm so sorry for the time it took, but I needed this kind of help to understand this.
I reckon it seems dumb for you, but I needed that exact question to figure it out.
Thank you again
Thank you so much ! That was exactly the help I needed. Indeed you're right and I was wrong! It doesn't work on this page even without the plugin.
I'll have a look on that. I'm so sorry for the time it took, but I needed this kind of help to understand this.
I reckon it seems dumb for you, but I needed that exact question to figure it out.
Thank you again
Quote from Pablo Borysenco on October 23, 2024, 09:52Hello
We always learn something new, that's the whole point
Welcome;)
Hello
We always learn something new, that's the whole point
Welcome;)