on this page … i need to display those writers
where exactly?
– at the top as a list? or in a sidebar?
to start, consider to create a category template for that particular category; http://codex.wordpress.org/Category_Templates
file name category-hyggehjoernet.php
might be related http://codex.wordpress.org/Template_Tags/wp_list_authors
My thought was something like a sidebar, with the a small box for every author, containing their name, picture, bio and a link to all their posts.
If you look at my page now, you will see somewhat the list i want to make. I don’t want it right there, but for now i am just trying to build the list, and then i will put it where it needs to be. Problem now is that i have stolen code from author.php and that does not get the info i want.
If you look here i think you will see what i mean:
http://mamuti.dk/category/hyggehjoernet/mit-liv-og-dagligdag/
My code looks like this:
<div>
<?php
$blogusers = get_users('blog_id=1&orderby=nicename&role=author');
foreach ($blogusers as $user) {?>
<div id="entry-author-info">
<h2><?php printf( __( 'About %s', 'smpl' ), $user->display_name ); ?></h2>
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'skeleton_author_bio_avatar_size', 120 ) ); ?>
<?php the_author_meta( 'description' ); ?>
<div class="clear"></div>
</div><?php
}
?>
</div>
I know the problem is that i ask to get meta from the wrong user (maybe even the wrong way), but i don’t know how to get it correctly.
I need a link to go to that authors posts. I have copied that code into the category-16.php also. But it is also stolen from author.php, so it doesn’t work.
<!-- Vis forfattere -->
<div>
<?php
$blogusers = get_users('blog_id=1&orderby=nicename&role=author');
foreach ($blogusers as $user) {?>
<div id="entry-author-info">
<h2><?php printf( __( 'About %s', 'smpl' ), $user->display_name ); ?></h2>
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'skeleton_author_bio_avatar_size', 120 ) ); ?>
<?php the_author_meta( 'description' ); ?>
<div id="author-link">
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
<?php printf( __( 'View all posts by %s <span class="meta-nav">→</span>', 'smpl' ), get_the_author() ); ?>
</a>
</div>
<div class="clear"></div>
</div><?php
}
?>
</div>
Well after hours of trial and error, i finally arrived at this solution:
<!-- Vis forfattere -->
<div>
<?php
$blogusers = get_users('blog_id=1&orderby=nicename&role=author');
foreach ($blogusers as $user) {?>
<div id="entry-author-info">
<a href="<?php echo get_author_posts_url( $user->ID ); ?>">
<h2><?php printf( __( 'About %s', 'smpl' ), $user->display_name ); ?></h2>
</a>
<?php echo get_avatar( $user->ID, apply_filters( 'skeleton_author_bio_avatar_size', 120 ) ); ?>
<?php the_author_meta( 'description', $user->ID ); ?>
<div id="author-link">
</div>
<div class="clear"></div>
</div><?php
}
?>
</div>
Now i only need to find out how to swap it to the right column of my page.
i did it by moving the code into my sidebar.php file, like this:
<!-- Vis forfattere -->
<?php if ( in_category('16'))
{
?>
<div>
<?php
$blogusers = get_users('blog_id=1&orderby=nicename&role=author');
foreach ($blogusers as $user) {?>
<div id="entry-author-info">
<a href="<?php echo get_author_posts_url( $user->ID ); ?>">
<h2><?php printf( __( 'About %s', 'smpl' ), $user->display_name ); ?></h2>
</a>
<?php echo get_avatar( $user->ID, apply_filters( 'skeleton_author_bio_avatar_size', 120 ) ); ?>
<?php the_author_meta( 'description', $user->ID ); ?>
<div id="author-link">
</div>
<div class="clear"></div>
</div><?php
}
?>
</div>
<?php } ?>