PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

content is printed 3 times

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 please
If 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.

Hi, by executing this function:

add_filter('woof_seo_do_index', function($do_index,$url,$request){
if ($do_index) {
add_action( 'woocommerce_before_main_content', function() {
$top_content='test';
echo $top_content;
} );
}
return $do_index;

},10,3);

 

it prints always 3 times, for example:"testtesttest", how can I make it echo just as in the variable"test"?

Hello

Yes, because you register this filter several times

You can try the trick for one execution. ( This is just an example without a test )

add_filter('woof_seo_do_index', function($do_index,$url,$request){
if ($do_index && !isset($_POST['i_did_it'])) {
add_action( 'woocommerce_before_main_content', function() {
$top_content='test';

$_POST['i_did_it'] = true;
echo $top_content;
} );
}
return $do_index;

},10,3);

Hi, thanks. Unfortunately same result. Are there any other hooks?

Hello

Please try this code:

add_filter('woof_seo_do_index', function($do_index,$url,$request){
if ($do_index ) {
add_action( 'woocommerce_before_main_content', function() {
$top_content='test';

if (isset($_POST['i_did_it'])){

return false;

}

$_POST['i_did_it'] = true;
echo $top_content;
} );
}
return $do_index;

},10,3);

It works. Awesome, thanks a lot! I'll leave a 5* review for plugin. By the way, is is possible to change name of attribute term OR do custom sorting?

For age filter, I use currently:

1 year+

2 year+

etc.

If I name terms"One year","Two years","Five years" etc, it'll be random sorting, doesn't make much sense. However current numeral setup looks bad

This can be corrected on the attribute editing page (attribute name)

order - https://share.pluginus.net/image/i20240329135641.png or or drag and drop on the attribute editing page

No, that's not the solution. I'll explain again.

I have currently age filter as follows:

0 year

1 year

2 year

It's sorted by age (number sorting works fine here). I use it, because if I changed it to letters, then sorting would be a mess:

Four year  (<4 year old showing as first)

Newborn

One year

Three year

Two year

etc. Mine question was if there's a custom sorting filter/hook. to make it as:

One year old

Two

Three

Four

etc. Additional question is if I could alter these values (display other than term name)

Hello

This plugin takes data from woocommerce.

To change the taxonomy name - change it on the taxonomy editing page

To change the sorting of terms, change this on the taxonomy editing page - https://share.pluginus.net/video/v20240401130839.mp4

Oh, thanks a lot! I have one more last question.

If you set url depth to 2 in seo url and you're on filter page, you can use hook woof_seo_do_index. but what if you use 3 filters, is there any hook I can use? For example, I make my own rules for robots and it works for:

/filter/color-black/

/filter/color-black/gender-male

 

but I need some hook when it's:

/filter/color-black/gender-male/?nocache

/filter/color-black/gender-male/size-large

Hello

To do this, the hook passes 3 parameters

$do_index,$url,$request

in this case it will be useful to you  $url and $request

for  example  check  size-large

if (isset($request['pa_size'])  &&  'large' == $request['pa_size']) {

// do something

}