Forum Replies Created

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter cabplan

    (@cabplan)

    OK so I did some research and got it working, there maybe a better way to write the code but here is what I got:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    				<h2><?php the_title(); ?></h2>
    
    				<?php the_content(); ?>
    
    			<?php endwhile; endif; ?>
    			    <?php
    $args = array( 'numberposts' => 15, 'order'=> 'DESC', 'orderby' => 'post_date' );
    $postslist = get_posts( $args );
    $authorlist = array("0");
    $rowcounter = 0;
    foreach ($postslist as $post) :  setup_postdata($post);$getid =$post->post_author;
     ?>
        <?php if(!in_array($post->post_author,$authorlist,false) && $rowcounter <6) { ?>
        <div class="author" id="author-<?php the_author_meta('user_login', $post->post_author); ?>">
        <a href="<?php bloginfo('url'); ?>/author/<?php the_author_meta('user_nicename', $post->post_author); ?>"> <span class="read-blog">Read</span>
          <?php if(get_the_author_meta('description', $post->post_author)): ?>
    
          <!-- Author Avatar -->
          <div class="description"> <?php echo get_avatar(get_the_author_meta('user_email', $post->post_author), 100); ?> </div>
          <?php endif; ?>
          <ul class="info">
            <li class="name">
              <?php the_author_meta('display_name', $post->post_author); ?>
            </li>
            <?php if(get_the_author_meta('location', $post->post_author) || get_the_author_meta('blog', $post->post_author)): ?>
            <?php if(get_the_author_meta('location', $post->post_author)): ?>
            <li class="location">
              <?php the_author_meta('location', $post->post_author); ?>
            </li>
            <?php endif; ?>
          </ul>
          <?php endif; ?>
          </a><?php $authorlist[] = $post->post_author;$rowcounter=$rowcounter+1;?> </div>
         <?php }?>
        <?php endforeach; ?>

    Hope this helps others

    Thread Starter cabplan

    (@cabplan)

    Wow, so funny right after I wrote this post, I went to the blog just to check it out to make sure it was working, and low and behold, one of the Admin accounts showed up again. This was because I removed the “NOT IN ($excluded)” from the statement. I went ahead and I tried Tim’s code above but basically it gave me the same result as the $exclude code.

    What is happening is that the blogger list is suppose to re-arrange itself when a new post gets posts, by putting the blogger who posted the newest post, it the number one spot on the homepage. Here is my blog:
    https://blogs.luc.edu/goglobal/
    You can see that the first blogger does not match the most recent post but as soon as I remove the “NOT IN ($excluded)” from the statement or the “post_author != 824 and post_author != 265 and post_author != 1691 and” the list appears correctly but adds the Admin accounts back in.

    Does anyone know another way to write this sql statement so that my Admin accounts do not show up but also that shows the correct order of the bloggers who blog frequently.

    Thread Starter cabplan

    (@cabplan)

    Well, the problem that was occurring was the Admin accounts were showing up in the list of the bloggers. The blogger list is suppose to change to the most recent blogger everytime they post a new post. The problem was that when I used that $exclude code, the bloggers stopped updating when a new blogger would post. As of this moment though since the bloggers are becoming more active, the Admin accounts have been pushed off, so even with the $exclude code gone our Admin accounts are not showing, so for the moment everything is fine, but thanks for all who replied. If the problem arises again I will try that $sql code above, that may be a solution for sure.

    Thread Starter cabplan

    (@cabplan)

    Two weeks, No Response, this forum is very bad

Viewing 4 replies - 16 through 19 (of 19 total)