• Hi Paul,

    I use the plugin to display people who host different events. So they post ‘events’ and not so many’posts’.

    I would like to have the author list to display a link to authors latest event (post type=event) OR their latest post with their author avatar – depending one which is the latest. Is that possible?

    Thank you for a great plugin.

    Best, Lars

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Paul Bearne

    (@pbearne)

    Yes but you are going to have to do some coding ??

    Have look at this fliter

    https://authoravatars.wordpress.com/documentation/filters/filter-aa_user_show_last_post_query/

    You will need to change the post_type to something like ‘post_type’ => array(‘posts’, ‘events’) so you get the latest post from both post types

    I hope this helps

    Paul

    Thread Starter Lars Henriksen

    (@adjunkten)

    Hi Paul

    Thanks. I haven’t coded anything – yet, but would like to try.

    I guess you are talking about this:

    add_filter( 'aa_user_show_last_post_query', 'aa_user_show_last_post_query', 10, 2 );
    function aa_user_show_last_post_query( $query, $user_id ){
    $query['category_name'] = 'new, uncategorized'; // addjut as needed
    return $query;
    }

    So here’s a wild guess ?? :

    add_filter( 'aa_user_show_last_post_query', 'aa_user_show_last_post_query', 10, 2 );
    function aa_user_show_last_post_query( $query, $user_id ){
    $query->set( 'post_type', array( 'post', 'event', 'topic' ) );
    return $query;
    }

    Will my site and all of the WWW go into WSOD with this code? ??

    Which plugin file do I edit and put in my theme?

    Lars

    Plugin Author Paul Bearne

    (@pbearne)

    Put the code in your theme or child theme if you didn’t create the the theme ( or create a plugin ) e.g. in code that you own

    try $query[‘post_type’] = array( ‘post’, ‘event’, ‘topic’ );

    As I think this is an array this is being passed

    Paul

    Thread Starter Lars Henriksen

    (@adjunkten)

    Thanks again, Paul. I put this code in my functions.php:

    add_filter( 'aa_user_show_last_post_query', 'aa_user_show_last_post_query', 10, 2 );
    function aa_user_show_last_post_query( $query, $user_id ){
    $query[‘post_type’] = array( ‘post’, ‘event’, ‘topic’ );
    return $query;
    }

    .. but it just breaks the list – it doesn’t show on my pages.

    Well, showing custom post types is only icing on the cake, so I won’t bother you anymore with this.

    Best, Lars

    Plugin Author Paul Bearne

    (@pbearne)

    the quotes‘’ look wrong change them for ‘

    look up how to use var_dump()

    var_dump($query);

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show link to authors last post => support custom post types?’ is closed to new replies.