WordPress.org

Ready to get started?Download WordPress

Forums

Simple User Listing
Re-add 'Latest Post' (2 posts)

  1. GizmoHKG
    Member
    Posted 1 year ago #

    Good evening!

    The original plugin on SM echoed the latest post by each author:

    <?php $latest_post = new WP_Query( "author=$author->ID&post_count=1" );
    			if (!empty($latest_post->post)){ ?>
    			<p><strong>Latest Article:</strong>
    			<a href="<?php echo get_permalink($latest_post->post->ID) ?>">
    				<?php echo get_the_title($latest_post->post->ID) ;?>
    			</a></p>
    			<?php } //endif ?>

    Any idea how to re-add that part back into your plugin? I've tried a few times but to no avail, it keeps echoing the latest post regardless of the author.

    Many thanks in advance!!

    http://wordpress.org/extend/plugins/simple-user-listing/

  2. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    Your args are messed up from mixing a PHP variable into a string. Try switching to the array method.

    You also not have a loop.

    Take a look at the codex.

    https://codex.wordpress.org/Class_Reference/WP_Query#Usage

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.