changes
This commit is contained in:
32
actions/DontShowProductsOnShopLandingPageAction.php
Normal file
32
actions/DontShowProductsOnShopLandingPageAction.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Actions;
|
||||
|
||||
use ofc\RadAction;
|
||||
|
||||
class DontShowProductsOnShopLandingPageAction extends RadAction
|
||||
{
|
||||
/**
|
||||
* @var string WordPress hook to attach to.
|
||||
*/
|
||||
protected string $hookName = 'init';
|
||||
|
||||
/**
|
||||
* @var int Hook priority.
|
||||
*/
|
||||
protected int $priority = 10;
|
||||
|
||||
/**
|
||||
* Your action callback.
|
||||
*/
|
||||
public function callback()
|
||||
{
|
||||
if (!is_shop()) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action('pre_get_posts', function ($query) {
|
||||
$query->set('posts_per_page', 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user