Curauth data in custom template (1 post)

  1. freeop
    Posted 5 years ago #

    I can get this information easy from the author template. If a copy the author template and rename to mytemplate, the curauthor no longer works..

    What do I have to do to get the $curauth data in a custom template ?

    <?php /* Template Name: MyTemplate */ ?>
    <?php get_header(); ?>

    // Code here //
    <?php echo $curauth->display_name; ?>

    <?php get_footer(); ?>

    I've searched and tried all the standard codes but I seem to be missing something :
    This currently works ok in author template, as does the other three versions of this code.
    <?php global $wpdb, $wp_query; $curauth = $wp_query->get_queried_object(); ?>

    They just don't work in a custom template and its driving me crazy..

Topic Closed

This topic has been closed to new replies.

About this Topic