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

    (@pbearne)

    This can done but you will need to some coding

    Have a look at the filters

    https://authoravatars.wordpress.com/documentation/developers-guide/

    You may have to read the code as there are a few extra flitters

    Good luck

    Thread Starter georodop

    (@georodop)

    Thanks a lot for your answer! I really appreciate your work on this great plugin.

    I have no problem using filters from my child theme’s functions.php and I already used the hooks aa_user_avatar_template and aa_user_name_template to make some modifications.

    Could you please provide a snippet that will get the title of the latest article for every author?

    Here is how I modified user’s name template to add a custom class:

    function change_aa_user_name_template () {
    	return '<span class="name custom_class">%s</span>';
    }
    add_filter('aa_user_name_template', 'change_aa_user_name_template');

    I used aa_user_name_template. Which hook would you recommend to use in order to add the post title under the author’s name?

    I can understand if you don’t have time to get into more details but it would be great if you could help me make some steps more.

    Thanks!
    George

    Plugin Author Paul Bearne

    (@pbearne)

    OK

    you will function like this

    function aa_get_last_post( $user_id ){
    $args=array(
      'author' => $user_id ,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => 1,
      'caller_get_posts'=> 1
    );
    $my_query =  $out = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post();
       $out .= ' <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>';
      endwhile;
    }
    
    wp_reset_query();  // Restore global post data stomped by the_post().
    return $out;
    }

    the problem is getting into the

    so you will need to add a placeholder in your current code

    function change_aa_user_name_template () {
    	return '<span class="name custom_class">%s</span>{{replace_me}}';
    }
    add_filter('aa_user_name_template', 'change_aa_user_name_template');

    then we need to use the “aa_user_final_content” filter to replace placeholder

    function change_aa_user_final_content ( $html, $user ) {
     return	str_replace( '{{replace_me}}', aa_get_last_post($user->ID), $html );
    }
    add_filter('aa_user_final_content', 'change_aa_user_final_content');

    this code hasn’t been tested

    I hope it points you in the right direction

    Please post your working when you fix it

    Paul

    Thread Starter georodop

    (@georodop)

    Great!

    I will test this tomorrow and post back describing what finally (hopefully) worked.

    Thanks again!

    I don’t know if it is appropriate to write in someone else’s post, but since i have the same problem, i thought there would be no problem.

    Anyway, i do also want to show tha latest article of every author. For now there is only name and gravatar showing up. But I want to add the post name of the writer below the name.

    I can modify css. But i really have no idea where to put your code, you posted before.

    It would be great if you guide me on that.

    Thank you.

    Plugin Author Paul Bearne

    (@pbearne)

    OK let think about this as this could be a new feature

    Thank you @paul Bearne,

    I don’t want bother you, but i have to do this ASAP. So if you have time, can you please give me a hint on where to put your code above.

    Best regards.

    Plugin Author Paul Bearne

    (@pbearne)

    Hi all

    I have added this the code on github

    https://github.com/pbearne/wp-author-avatars/archive/master.zip

    Download this and install it and test

    And let me know if works for you

    If its OK I will include it in the next version

    Charge your clients for it and sent me a cut.

    Paul

    It does work, and works well. Exactly the way my client wanted.
    I can’t tell you how grateful i am.

    Thank you very very much, and i definitely am planning to donate, as soon as i am paid ??

    PS: I just activated the plugin, and after seeing that it works, i began writing this. So i have no idea about any conflicts, which i doubt there will be any. Should there be anything going bad, i will inform you.

    Best regards.

    Hello @paul Bearne,

    The plugin works fine, since i can add latest post for the authors.
    I don’t know if this problem is just for me, but i can’t add e-mail of the author.
    Even i click on e-mail checkbox, nothing shows up. It may be caused by something else as i installed your previous plugin, and same problem exists.

    Thank you.

    Plugin Author Paul Bearne

    (@pbearne)

    I will have look on monday

    Thread Starter georodop

    (@georodop)

    The updated plugin worked great for what I wanted. I was already thinking about donating and now I have one more reason.

    Plugin Author Paul Bearne

    (@pbearne)

    Ruzger

    I was’t able to see the problem of the missing email

    Any more clues?

    I believe it has something to do with my template, or maybe a conflict between plugins, i don’t know.

    What i know is, even i select “show email” check box, nothing shows up.

    Thank you for your kind reply, i appreciate it.

    here is the link of the site, if you have time.

    ucuncutaraf.com

    Although i don’t believe that option is essential, my client wants it, and i really would be happy if you can assist me on this.

    In your code, where to look at, should be good for a starter.

    Thanks again for your time.

    Hello @paul Bearne

    Haven’t heard from you for a while.

    The problem still remains. Any suggestions.

    Thank you.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Show latest article for every author’ is closed to new replies.