Forum Replies Created

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter Erik Ford

    (@wearepixel8)

    Thank you so much. That worked like a charm.

    Thread Starter Erik Ford

    (@wearepixel8)

    Thanks for all of your help today. It’s still not working for me. I get the following error:

    Parse error: syntax error, unexpected ‘{‘

    which is referring to the bracket following if ((++$post_counter % 4 == 1)

    I don’t want to waste your time so I will probably have to table this idea until I can figure out how to make it work. Thanks again.

    Thread Starter Erik Ford

    (@wearepixel8)

    Thanks for helping with this. It looks like I didn’t something wrong somewhere in my code. I used the additional if statement you suggested for my query:

    <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 8");
    foreach ($result as $post) {
       setup_postdata($post);
       $postid = $post->ID;
       $title = $post->post_title;
       $commentcount = $post->comment_count;
       if ($commentcount != 0) {
          if ((++$post_counter % 4 == 1) {
             if ($post_counter > 1) {
                echo "</div><!-- End of slides -->\n";  // End previous grp
             }
             echo "<div class='slides'>\n";  // Start a new grp
          }
    
    ?>

    Followed by my code that would wrap each result, with 4 results being wrap by a div.slides.

    <div class="slides">
    <-- 4 results -->

    I didn’t place a closing div for slides inside of the loop because it seemed like the if statement was going to do so. Am I correct?

    At the end of the loop I have:

    <?php if ($post_counter) echo "</div><!-- End of slides -->\n"; ?>
    
    <?php } ?><!-- closing if post counter statement -->
    <?php } ?><!-- closing custom query -->

    Is this how I should set this up? Again, your help is much appreciated.

    Thread Starter Erik Ford

    (@wearepixel8)

    It’s at this moment that I realize that I have been looking at this code for way too long. Thanks so much. Sometimes I need someone else to look at the bonehead mistakes and help.

    Thread Starter Erik Ford

    (@wearepixel8)

    I did try to set up the following variables, which failed miserably:

    $cat_name = get_option('wap8_block1');
    $cat_id = get_category_id($cat_name);
    $cat_link = get_category_link($cat_id);

    Then, inside of the loop, I have <a href="<?php echo $cat_link; ?>">. This returns nothing and breaks this and all subsequent loops. Any suggestions? Thanks again.

Viewing 5 replies - 16 through 20 (of 20 total)