Disable pjax for a specific link within the main-page-wrapper
-
Hi,
every link within the main-page-wrapper is pjax-executed
but I want to disable pjax for a specific link.. I tried to add
data-pjax=”0″
data-pjax=”false”
target=”_blank
to the <a but no luck
Can you suggest a solution? I DO NOT WANT to disable ajax globally
also, it does not seem to happen with 6.5.4, it only appeared with 7.X
TY
M
Hello,
Please try to use the below code for that, enter it into the functions.php
file in your child theme.
add_filter( 'woodmart_ajax_links', function ( $link ) {
$link .= ', a[data-pjax!="0"], a:not(.wd-not-pjax)';
return $link;
});
Through commas, add the classes to the $link variable in which you want to exclude links.
Kind Regards
Hi Luke,
thanks!
are the values returned by $link referring to the links that should pjax, or the links that should not? based on your code, it looks the former to me, so working as an include list rather than excluding.
I tried to add the CSS selector for the link I want to EXCLUDE from pjax, but it did not work
m
Hi,
I copied your snippet to my functions.php, and added bot the class
wd-not-pjax
and the
data-pjax=”0″
to my link, but still pjax is called
m
One more
I checked the $link value passed, and noticed this:
.wd-shop-tools a:not(.breadcrumb-link)
so I added that class to my link, but still pjax kicked in
but it also kicked in the the actual .breadcrumb-link…
so it seems to me pjax is forcely executed no matter what the woodmart_ajax_links filter says…
do I have to turn ajax off globally in the settings?
m
HI,
never mind, I think it is the BeRocket Ajax filter plugin that forces pjax…
TY
m
Hello,
Ok, please let me know if you sorted it out.
If there’s anything else we can do, please get in touch.
Kind Regards