WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to store the_author in a variable.. (4 posts)

  1. sithicus
    Member
    Posted 7 years ago #

    <?php
    $author = the_author_email();
    ?>

    I want to store the_author_email into a varible.. so I can call it later in the page inside of some html.. the problem is when I do the above code it echo's the_author_email to the screen! ahhhuughh

  2. whooami
    Member
    Posted 7 years ago #

    thats because thats the authors email, not the author.

    the_author(); is the author.

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

  3. sithicus
    Member
    Posted 7 years ago #

    so if I wanted to return "the_author" inside of a tag..

    <div class="<?php the_author(); ?>"> ?

  4. Chanpory
    Member
    Posted 7 years ago #

    The way to do it is to use the get_the_author tag.

    <?php $author = get_the_author(); ?>

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

Topic Closed

This topic has been closed to new replies.

About this Topic