Forums Forums Search & Filter Pro Permalink changes with pagination

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #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">&euro; 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
    #96384

    In the item-more bit, try changing:

    <a href="<?php echo $permalink; ?>"

    to

    <a href="<?php the_permalink(); ?>"

    Anonymous
    #96423

    That’s not working either.
    I wrote that variable myself to test, but the_permalink() isn’t working.

    As I said, a couple of things are being added to the permalink and I really don’t want/need that.

    Trevor
    #96521
    This reply has been marked as private.
    Anonymous
    #96542
    This reply has been marked as private.
    Trevor
    #96551

    I 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?

    Anonymous
    #97210

    Thanks Trevor, that was the problem!
    Stupid mistake.

    Thanks for the quick support!

Viewing 7 posts - 1 through 7 (of 7 total)