Forum Replies Created
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
lomaymiMember
Just figure it out after many hours of trial and error. Will post my code here so anyone can use as reference:
<!-- AUTHOR BLOG POST LOOP 2 COLUMNS --> <h2>Post by <?php echo $curauth->first_name; ?></h2> <br> <!-- Set parameters to display in posts loops--> <?php $args1 = array( 'numberposts' => 2, 'offset' => 0, 'author' => $authordata->ID, 'post_not_in' => array( $post->ID ) ); $args2 = array( 'numberposts' => 2, 'offset' => 2, 'author' => $authordata->ID, 'post_not_in' => array( $post->ID ) ); // This is for author remaining blog posts $args3 = array( 'offset' => 4, 'author' => $authordata->ID, 'post_not_in' => array( $post->ID ) ); ?> <div class="author_columns"> <!-- First column loop posts --> <div class="one-half first"> <?php query_posts('showposts=2'); ?> <?php $posts = get_posts($args1); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "2") { break; } else { ?> <a>"><?php the_post_thumbnail('medium'); ?> </a> <h3><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt (); ?> <?php $count1++; } ?> <?php endforeach; ?> </div> <!--Second column loop posts offset 2--> <div class="one-half"> <?php query_posts('showposts=2'); ?> <?php $posts = get_posts($args2); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "2") { break; } else { ?> <a>"><?php the_post_thumbnail('medium'); ?> </a> <h3><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt (); ?> <?php $count2++; } ?> <?php endforeach; ?> </div> </div> <!--AUTHOR REMAINING BLOG POST LIST AFTER FOURTH ENTRY --> <ul class="author_post_list"> <?php $myposts = get_posts( $args3 ); foreach ( $myposts as $post ) : setup_postdata( $post ); ?> <li><h4><a>"><?php the_title(); ?></a></h4></li> <?php endforeach; wp_reset_postdata();?> </ul>
Here are a couple of resources I found very useful:
- Code Reference: the_excerpt()
- Codex: Post Thumbnails
- Codex: Template Tags/get posts
- How to Display Related Posts by Same Author in WordPress
- get_posts - get all posts by author id
- 6 Ways to Display WordPress Post Content in Multiple Columns
If you got any questions about my code feel free to reply.
lomaymiMemberJust figure it out after many hours of trial and error. Will post my code here so anyone can use as reference:
<!-- AUTHOR BLOG POST LOOP 2 COLUMNS --> <h2>Post by <?php echo $curauth->first_name; ?></h2> <br> <!-- Set parameters to display in posts loops--> <?php $args1 = array( 'numberposts' => 2, 'offset' => 0, 'author' => $authordata->ID, 'post_not_in' => array( $post->ID ) ); $args2 = array( 'numberposts' => 2, 'offset' => 2, 'author' => $authordata->ID, 'post_not_in' => array( $post->ID ) ); // This is for author remaining blog posts $args3 = array( 'offset' => 4, 'author' => $authordata->ID, 'post_not_in' => array( $post->ID ) ); ?> <div class="author_columns"> <!-- First column loop posts --> <div class="one-half first"> <?php query_posts('showposts=2'); ?> <?php $posts = get_posts($args1); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "2") { break; } else { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('medium'); ?> </a> <h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt (); ?> <?php $count1++; } ?> <?php endforeach; ?> </div> <!--Second column loop posts offset 2--> <div class="one-half"> <?php query_posts('showposts=2'); ?> <?php $posts = get_posts($args2); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "2") { break; } else { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('medium'); ?> </a> <h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt (); ?> <?php $count2++; } ?> <?php endforeach; ?> </div> </div> <!--AUTHOR REMAINING BLOG POST LIST AFTER FOURTH ENTRY --> <ul class="author_post_list"> <?php $myposts = get_posts( $args3 ); foreach ( $myposts as $post ) : setup_postdata( $post ); ?> <li><h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4></li> <?php endforeach; wp_reset_postdata();?> </ul>
Here are a couple of resources I found very useful (couldn’t post hyperlinks, it appears this marks message as spam. Just do a Google search):
- Code Reference: the_excerpt()
- <Codex: Post Thumbnails
- Codex: Template Tags/get posts
- How to Display Related Posts by Same Author in WordPress
- get_posts - get all posts by author id
- 6 Ways to Display WordPress Post Content in Multiple Columns
If you got any questions about my code feel free to reply.
lomaymiMemberThanks Victor for your help. This put me on the right direction.
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)