WP Biographia
[resolved] Include biography box on author archive even if the user has no posts (9 posts)

  1. Andrew W
    Posted 2 years ago #

    Quick question (I think): I assume wp-biographia is set such that it does not return the biography box if a user has no posts, for example...

    This, with posts and thus with a biography box: http://cmsw.mit.edu/profile/andrew-whitacre/


    This, without posts and thus without a box: http://cmsw.mit.edu/profile/jamie-folsom/

    My question is, how/where in the code would I tell wp-biographia "Even when the loop comes up empty, still print the biography box"?


  2. vicchi
    Plugin Author

    Posted 2 years ago #

    This is easily doable; but I'm on family vacation right now. Will reply in more details next week when I'm back on a broadband connection and not using mobile data roaming!

  3. Andrew W
    Posted 2 years ago #

    Beautiful, thanks!

  4. vicchi
    Plugin Author

    Posted 2 years ago #

    So I've just taken a look at this and the short answer to your question is it depends on how you're producing the Biography Box.

    I'm assuming you're either using one of the plugin's template tags or the plugin's shortcode, embedded within the author archive template?

    Once I know how you're doing things, I should be able to recommend a solution based on your current implementation. Hopefully!


  5. Andrew W
    Posted 2 years ago #

    Actually, neither (and maybe that's what I should be trying!). I've been using the plugin's built-in options, with the following selected:

    • Display on Individual Posts
    • Display the excerpt of the user's biography
    • Display the Biography Box after the post or page content
  6. vicchi
    Plugin Author

    Posted 2 years ago #

    Really? That doesn't make a lot of sense. If that was the case, I'd expect to see multiple Biography Boxes on the author archive page, one per post. It might help if I can see the code of that page template? What theme are you using and the author archive template been customised at all?


  7. Andrew W
    Posted 2 years ago #

    Thanks for taking the time, Gary. Now that I look at the author.php code, looks like I used the shortcode...

    <?php get_header(); ?>
    <div id="main" class="archives">
    	<div id="content">
    		<div class="wrapper-content">
    			<?php $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); ?>
    			<div class="breadcrumbs">
    				<?php if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('<p id="breadcrumbs">','</p>');
    } ?>
    			</div><!-- end .breadcrumbs -->
    			<div class="intro intro-archives">
    				<h1><span><?php echo $curauth->display_name; ?></span></h1>
    				<p><?php echo do_shortcode('[wp_biographia author]'); ?></p>
    			</div><!-- end .intro -->
    			<div class="widget">
    				<?php get_template_part('loop','author'); ?>
    			</div><!-- end .widget .recent-posts -->
    			<div class="cleaner">&nbsp;</div>
    		</div><!-- end .wrapper-content -->
    	</div><!-- end #content -->
    		<?php get_sidebar(); ?>
    		<div class="cleaner">&nbsp;</div>
    		<div id="aside-fade">&nbsp;</div><!-- end #aside-fade -->
    	<div class="cleaner">&nbsp;</div>
    </div><!-- end #main -->
    <?php get_footer(); ?>
  8. vicchi
    Plugin Author

    Posted 2 years ago #

    The call to the shortcode is invalid as the author parameter has to take an argument, which is a user's login name, so by specifying the shortcode as [wp_biographia user], the user parameter is effectively ignored.

    Try replacing your current code, which reads ...

    <?php echo do_shortcode('[wp_biographia author]'); ?>

    ... with ...

    	if (isset($curauth) && !empty($curauth)) {
    		echo do_shortcode('[wp_biographia user="' . $curauth->user_login . '"]');

    You should actually be using one of the plugin's template tags here, but testing this has thrown up a bug, so this should do the job until the next version of the plugin.


  9. Andrew W
    Posted 2 years ago #

    Alright! That did it. And glad I could indirectly help find a bug. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Biographia
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic