• Resolved jacob0601

    (@jacob0601)


    I am not sure I would say it breaks them exactly, but any new posts that load via infinite scroll, the permalinks get messed up. I am doing this all locally for the time being so I can not link to a site, but I can included the behavior here in the post.

    This is the code I have for each post on the front page (that are being loaded via infinite-scroll):

    <div class="preview_image">
    	<div class="preview_data">
    		<?php $category = get_the_category(); ?>
    		<div class="post-categories"><a href="<?php echo get_category_link($category[0]->cat_ID); ?>"><?php echo $category[0]->cat_name; ?></a></div>
    		<p class="archive_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
    		<div class="clearer"></div>
    	</div>
    	<a href="<?php the_permalink(); ?>" />
    	<?php echo get_preview_thumbnail(); ?>
    	</a>
    </div>

    That above makes each preview thumbnail a clickable link to the single post and that works for every post that loads before infinite scroll loads any.

    Once infinite scroll loads additional posts I can no longer click the images to get the next posts. The archive_title is still clickable, but I would like to still be able to click the images.

    Not sure why this is happening or if I am missing something but when inspecting the <a> elements, the ones that are loaded by infinite scroll are 0px by 0px and the ones that are originally loaded on the front page (not by I-S) have some size to them.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jacob0601

    (@jacob0601)

    I found something about what is going on.

    So the original content loads with the preview_thumbnail inside of the a link, but any content that loads via infinite-loop is outside of the a link.

    Original content:

    <a href="https://linkhere.com">
    <img width="300" height="150" src="https://imagehere.jpg" class="attachment-post-thumbnail wp-post-image" alt="">
    </a>

    Infinite – scroll loaded:

    <a href="https://linkhere.com">
    </a>
    <img width="300" height="150" src="https://imagehere.jpg" class="attachment-post-thumbnail wp-post-image" alt="">

    Not sure why this is happening:(

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    This code in your post is wrong:

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

    Notice that / at the end of the first line? That is a self-closing link. Links should not be self closing. Try removing that ending slash.

    Thread Starter jacob0601

    (@jacob0601)

    Holy crap; what a stupid mistake on my part; that is completely correct and fixed the issue right up. Sometimes another set of eyes just helps out so much.

    THANK YOU!!!

    I am having another slight issue as well, I will start a new topic about it though since it is different than this posting.

    Again, thanks so much Otto.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin:Infinite-Scroll] 'Breaks' permalink’ is closed to new replies.