Artikelen

Avatars in WordPress

Gepost door joost op 12 nov 2010 in de categorie CMS
Gebruikers van WordPress zullen zich aan het begin gegarandeerd afvragen waar je je een avatar kunt uploaden. Een logische vraag. Nergens is er immers een upload veld voor user afbeeldingen te vinden. Dat komt door de filosofie dat avatars 'global' zouden moeten zijn (zie 'gravatars' voor meer info). Daarom is standaard niet beschikbaar. Natuurlijk hoeven we het niet eens te zijn met dat idee. Vandaar hierbij de uitleg hoe je deze ontbrekende functionaliteit aan WordPress toevoegd.

WordPress is all about plugins... Maar je moet wel de juiste hebben. Hieronder heb ik de juiste weergegeven voor dit probleem. Installeren maar! Succes!


Add Local Avatar
Adds local (private) avatars for your users. Maybe your users don't want a global avatar, aren't IT savvy enough to set a Gravatar up, simply want a private avatar for your blog, or any other reason too... The plug-in now delivers the much requested feature of allowing users to upload their own local avatar. And, the latest new feature allows your users to use their Twitter avatar. The order o… By Peter Sterling.


Toon de avatars in je theme
Dan wil je ze natuurlijk nog ergens in je theme tonen... Zo kan je bijvoorbeeld de laatste twee posts met bijbehorende avatars laten zien door een nieuwe loop uit te voeren. Dit gaat zo:

<?php

//The Query

query_posts('posts_per_page=2');

//The Loop

if ( have_posts() ) : while ( have_posts() ) : the_post();

echo "<div style=\"float: left; width: 360px; padding-bottom: 15px;\">";
echo "<div style=\"float: left; margin-right: 5px;\">".get_avatar($post->post_author)."</div>";
?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br />

<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
<small><?php the_time('F jS, Y') ?> by <?php the_author(); ?></small><br />

<?php
echo "</div>"; endwhile; else:

echo "niet gevonden";

endif;

//Reset Query

wp_reset_query();

?>





Terug