Forums › Forums › Search & Filter Pro › Permalink changes with pagination
Tagged: permalinks
- This topic has 6 replies, 2 voices, and was last updated 7 years, 8 months ago by Anonymous.
-
Anonymous(Private) March 13, 2017 at 4:44 pm #96357
Hi!
Great plugin, but I’m having a problem right now.
Everything is working with a search box and filters, but when I use (in this case) the infinite scroll option, every post that loads gets a changed permalink.The code I use within the ‘while’ loop for a post is this:
<div class="item route"> <div class="item-image"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('formatted'); ?> <div class="item-image-overlay"></div> </a> <h3 class="item-title"><?php the_title(); ?></h3> </div> <!--<div class="item-price"></div> <div class="price-tag"> <span>vanaf</span> <span class="price">€ 59,<sup>50</sup></span> <span>p.p.</span> </div>--> <div class="item-content"> <h4><?php echo $arrCity; ?><?php echo $arrProvince; ?><?php echo $arrRegion; ?></h4> <?php the_field('korte_omschrijving'); ?> </div> <div class="item-more"> <a href="<?php echo $permalink; ?>" class="btn btn-block ajax" data-url="<?php the_permalink(); ?>" data-title="<?php the_title(); ?>">Bekijk route <i class="fa fa-angle-right" aria-hidden="true"></i></a> </div> </div>
The problem is that ‘the_permalink()’ is changed.
A piece of code is added by the plugin, e.g. permalink/?sf_paged=2.
I really need to get rid of the added code because I use Ajax to load the content of that post in a modal.Hopefully my problem is clear enough.
Thanks in advance!Alex
Trevor(Private) March 14, 2017 at 9:32 am #96551I think I see the issue. On page load, a javascript is attaching the modal code to the cards. There are two ways to do this (without me looking at yuor code):
#1 Direct javascript that runs when the page/document is ready.
#2 A javascript function, which is then called when the page/document is ready.Your code needs to written as the second. Test to make sure that still works for the page as it loads by default, then add to the code, something like this:
(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your card modal script function here again }); }(jQuery));
I think that is the issue? Unless I have misunderstood?
-
AuthorPosts