• Resolved BandittenJacob

    (@bandittenjacob)


    Hey all.

    I am running the WP-Skeleton theme. I have made my menues, so that they display my post categories and when you select them, you go to the Category page, displaying info on that particular category, followed by the posts in that category. I have a category, reserved for permanent writers, writing their own blog. Now on this page (http://mamuti.dk/category/hyggehjoernet/mit-liv-og-dagligdag/) i need to display those writers. As of now they all have the status of contributor, but i am thinking of changing that to author, if that would help anything. If i change it, they would be the only ones with the author status on my page, so i thought that would be a way to pick them out of the bunch.

    Thank you all in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    Thread Starter BandittenJacob

    (@bandittenjacob)

    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.

    Thread Starter BandittenJacob

    (@bandittenjacob)

    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.

    Thread Starter BandittenJacob

    (@bandittenjacob)

    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">&rarr;</span>', 'smpl' ), get_the_author() ); ?>
    				</a>
    				</div>
    			<div class="clear"></div>
    		</div><?php
    		}
    	?>
    </div>

    Thread Starter BandittenJacob

    (@bandittenjacob)

    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.

    Thread Starter BandittenJacob

    (@bandittenjacob)

    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 } ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Insert author-info on certain category page’ is closed to new replies.