WordPress.org

Ready to get started?Download WordPress

Forums

WP Biographia
[resolved] How to display biography at author's archive if author doen't have posts yet (2 posts)

  1. gxtq
    Member
    Posted 1 year ago #

    Hi, very nice plugin!

    Adding echo do_shortcode('[wp_biographia]'); to the top of the theme's archive page works, but when the author has no posts it will not display even if the call is placed outside the if (have_posts()) loop.

    Is there a way to display the biography at the top of the author's archive page if the author doesn't have any posts yet?

    I've tried setting all the display options on and off.

    http://wordpress.org/extend/plugins/wp-biographia/

  2. vicchi
    Member
    Plugin Author

    Posted 1 year ago #

    Adding echo do_shortcode('[wp_biographia]'); to the top of the theme's archive page works, but when the author has no posts it will not display even if the call is placed outside the if (have_posts()) loop.

    This is just the way in which WordPress works. The have_posts() call will only return true if there are posts to display and the_post() call sets up the data structures for each post, including the author.

    The way it looks like you're trying to make this work will only work inside the WordPress Loop as the post and author data is only set up during the Loop. Outside of the Loop, there's no author data and so the shortcode will have no author to work with and won't emit the Biography Box.

    Is there a way to display the biography at the top of the author's archive page if the author doesn't have any posts yet?

    Yes. You need to specify which user you want the Biography Box to be displayed for, as WordPress can't work this out for you as everything is keyed on the post data, including the author; if there's no posts then there can't be an author.

    Try using [wp_biographia user="user-name"] instead. See http://wordpress.org/extend/plugins/wp-biographia/other_notes/ or http://www.vicchi.org/codeage/wp-biographia/4-shortcode-usage-and-support/ for documentation.

    Or rather than wrapping the shortcode in a call to do_shortcode, use one of the plugin's template tags, wpb_get_biography_box or wpb_the_biography_box. See http://wordpress.org/extend/plugins/wp-biographia/other_notes/ or http://www.vicchi.org/codeage/wp-biographia/6-template-tags/ for documentation.

    -Gary

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.