• Resolved Tara Rotten

    (@tara-rotten)


    Hey,

    This plug in is amazing!

    Im really new to php / code so need some help.

    I have a 6 avatars in my sidebar using this widget, below the avatars i would like to add a link to a page showing all the users, ie ‘view all bloggers’ anyway i can add this? my side bar uses dropdown(hide reveal) widgets so i cant just add a link in a text widget under the author widget help pleasee

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Ben

    (@bforchhammer)

    The plugin applies a bunch of (undocumented) filters on the different templates used for generating the output, which you might be able to use. All hooks are in Userlist.class.php (search for the use of the “apply_filters” function).

    For your case you probably want to use the “aa_userlist_template” filter. You can use it by adding for example the following to your theme’s functions.php:

    <?php
    function aa_userlist_add_link_to_all( $template ) {
      $url_link = '/all-bloggers';
      $url_text = 'View all bloggers';
      $template .= '<span class="all_bloggers_link"><a href="' . $url . '">' . $text . '</a></span>';
      return $template;
    }
    add_filter('aa_userlist_template', 'aa_userlist_add_link_to_all');
    ?>

    I haven’t tested it but this is how it should work in principle; you obviously need to adjust $url_link and $url_text, and add respective styling for span.all_bloggers_link to your theme…

    The default value for $template is '<div class="author-list">{users}</div>' and above function simply adds a link to the end of it.

    Hope this helps.

    Ben

    Thread Starter Tara Rotten

    (@tara-rotten)

    AMAZING!! works so good.

    any way i can place it in the author-list div as im using a dropdown widget plugin which hides and reveals widgets on a loop and right now my v’iew all’ link is outside the hide show area

    Thanks so much for the help

    Plugin Contributor Ben

    (@bforchhammer)

    Try this version (which overrides the plugin’s default template):

    <?php
    function aa_userlist_add_link_to_all( $template ) {
      $url_link = '/all-bloggers';
      $url_text = 'View all bloggers';
      $template = '<div class="author-list">{users} <span class="all_bloggers_link"><a href="' . $url . '">' . $text . '</a></span></div>';
      return $template;
    }
    add_filter('aa_userlist_template', 'aa_userlist_add_link_to_all');
    ?>
    Thread Starter Tara Rotten

    (@tara-rotten)

    Thanks starting to get the hang of it just trying to figure out how to only have this ‘view all’ link work in the widget and not on my page displaying all my bloggers

    Plugin Contributor Ben

    (@bforchhammer)

    Good point, I didn’t think of that… I don’t think there’s an easy way to change the template only for one instance and not the other, but you could use css styling to hide or show it respectively.

    Add something like the following to your theme’s css:

    .main_content .author-list .all_bloggers_link {
      display: none;
    }

    You need to change .main_content to a class that actually exists in your theme (and which is attached to the main content area).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Author Avatars List] Link under widget’ is closed to new replies.