Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2929350
Infinite loop first post?
Closed

Comments

  • maciek_l started the conversation

    Hi,

    How can I check if a given entry is the first entry in the loop?
    Unfortunately, Disqus only works in the first post. I would like to loop through the "Go to Comments" button, but I do not know how to formulate a conditional statement so that it does not appear in the first entry.

    I'd like to do this in /template-parts/single-content-main.php


    Regards

  •  2,612
    PenciDesign replied

    Hi,

    The content on the template file below only shows the single post content & just 1 post only.

    /template-parts/single-content-main.php

    If you want to check the first entry in the loop, you can view the concept below:

    <?php
    $inc = 1;
    $the_query = new WP_Query();
    $the_query->query("posts_per_page=4");
    if ($the_query->have_posts()) :   while($the_query->have_posts()) : $the_query->the_post();
        if($inc == 1){    //first post here
       //do stuffs here
        }
        else{
      //the rest of the posts
        }  $inc++; //counter
    endwhile; endif; wp_reset_postdata();
    ?>

    Regards,
    PenciDesign.



  • maciek_l replied

    Hmm ... so which file should I edit if not /template-parts/single-content-main.php?

    I would like to get the effect like here:
    https://antyweb.pl/black-week-allegro

    The first post shows disqus, but in the next post, in the infinite loop, there is a button "Pokaż komentarze" in place of disqus.

  •  2,612
    PenciDesign replied

    Hi,

    About your request, there 2 files you need to modify:

    • wp-content/themes/soledad/content-single.php
    • wp-content/themes/soledad/comments.php
    • wp-content/themes/soledad/inc/load_next_prev_posts.php: this file will render the content via AJAX. You can modify it here.

    Regards,
    PenciDesign.