WordPress.org

Ready to get started?Download WordPress

Forums

How to make my own author archive page Please Help!! (2 posts)

  1. jf317820
    Member
    Posted 7 years ago #

    Hi everyone, I'm new to WordPress, but not necessarily to web dev...

    I'm having trouble figuring out how I can make an author archive page...i would use the one provided, but I need to make it *without* the header image.

    So I tried using my own "fake header" to load the functions and other necessary parts of the page other than the header image and navigation. I can't seem to get the php to run correctly. Am i doing this incorrectly?

    THIS IS THE CODE FOR MY CUSTOM PAGE


    <?php require('fakeheader.php'); ?>
    <?php get_header(); ?>
    <?php is_author(2); ?> \this may not work, but I'm trying to call the posts of the author whose key is "2"
    <div id="content">test
    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <h2 class='archives'>Author Archive</h2>
    <?php }

    elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    <h2>Blog Archives</h2>
    <?php } ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="entry">
    <h3 class="entrytitle" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php the_title(); ?>
    </a> </h3>
    <div class="entrymeta">
    Posted <?php
    the_time('F j, Y ');
    $comments_img_link= '<img src="' . get_stylesheet_directory_uri() . '/images/comments.gif" title="comments" alt="*" /><strong>';
    comments_popup_link($comments_img_link .' Comments(0)', $comments_img_link .' Comments(1)', $comments_img_link . ' Comments(%)');
    edit_post_link(__(' Edit'));?>
    </strong> </div>
    <div class="entrybody">
    <?php the_content(__('Read more &raquo;'));?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>
    <?php endwhile; else: ?>
    <p>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    </p>
    <?php endif; ?>
    <p>
    <?php posts_nav_link(' — ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
    </p>
    </div>
    <?php get_footer(); ?>

  2. moshu
    Member
    Posted 7 years ago #

    1. Don't post long code here... nobody raeds it :0
    Use http://wordpress.pastebin.ca

    2. <?php require('fakeheader.php'); ?>
    <?php get_header(); ?>

    You can't have both: get_header is defined WP function and it will always call the header.php of the theme.
    If you want your own - include it with
    <?php include (TEMPLATEPATH . '/fakeheader.php'); ?>
    Use it lieterally as it is and make sure the feakeheader.php file is in the theme's directory.

    3. The rest is complicated for me - I am not a coder. Just naming it "author.php" should work without any code hocus-pocus. WP knows what an author template is.

    More: http://codex.wordpress.org/Author_Templates
    Special attention to the References at the bottom of the page - don't come back before reading those!!!

Topic Closed

This topic has been closed to new replies.

About this Topic