Forums

Displaying Post Formats for a User (3 posts)

  1. adarco
    Member
    Posted 8 months ago #

    I trying to have my author pages display the most recent post within a certain Post Format in my case Links. My code is as follows:

    http://pastebin.com/VjhBTLxf

    I am pretty sure I'm close, but I need some help getting over the final hump on this.

  2. Digital Raindrops
    Member
    Posted 8 months ago #

    Untested Example:

    <?php
    $a = $author->ID;
    $post_args = array(
    	'author' => $a,
    	'post_type'=>'page'
    	'posts_per_page' => $number,
    	'paged' => $paged;
    );
    $post_query = new WP_Query( $post_args );
    ?>
    
    <?php if ( $post_query->have_posts() ) : ?>
    
    	<?php while ( $post_query->have_posts() ) : $post_query->the_post(); ?>
    
    	<?php endwhile; ?>
    
    	<?php rewind_posts(); ?>
    
    <?php endif ?>

    HTH

    David

  3. adarco
    Member
    Posted 8 months ago #

    First off, thank you for your crazy fast response.

    There were a couple of minor issues with your code.

    You missed a comma after 'page' and there is a semi-colon after $paged.

    After I caught those, it wasn't doing what I hoped. This is probably my fault that I didn't explain this a little better above. So, lets see if this helps:

    I have several different Authors. On each of their pages I need their latest post to display (which I have accomplished) and I also need their latest post that has the post format of Links.

    Thank you,
    Anthony

Reply

You must log in to post.

About this Topic