WordPress.org

Ready to get started?Download WordPress

Forums

author meta tag in header (4 posts)

  1. Marc P Gangmei
    Member
    Posted 4 years ago #

    The code below doesn't work with the header.php but it show in other place eg. the sidebar.
    <?php the_author_meta('headerads'); ?>

    Can anyone tell me the reason why and show me the way. I am starting a collaborative blog. I will to show user specified ads in the header from their profile page.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    You need to specify a user id outside of the Loop.

    http://codex.wordpress.org/Template_Tags/the_author_meta

  3. Marc P Gangmei
    Member
    Posted 4 years ago #

    Dear esmi
    specifying a user id for each users will be a tiresome jobs to do. It means I have to create custom headers for each users. Suppose if I have 1000s users!!!??

    I think WordPress is missing on this.

  4. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    'there are no problems unless you create them youself'

    assuming that this only makes sense on single post display,
    you could simply make a loop if there is no - try and use this where you had your line:

    <?php if(is_single()) :
    while ( have_posts() ) : the_post(); 
    
    the_author_meta('headerads'); 
    
    endwhile; wp_reset_query();
    endif;   ?>

Topic Closed

This topic has been closed to new replies.

About this Topic