Grow your CSS skills. Land your dream job.

Show posts by specific user (wordpress)

  • # October 18, 2009 at 2:37 am

    So, I’m using Word Press, and I have multiple users. I want to have ‘About’ pages for each user and have their blog posts under it.

    How can I do this?

    # October 18, 2009 at 3:12 am

    I recently did this for a client of mine. I intend to write the process up on a blog post (eventually) but for you – here are the steps involved.

    1. Create a template in your theme for your about pages
    2. Create about pages, assign template created in step 1 to each page
    3. Create custom field ‘author’ on about pages and assign the numerical author id

    Here’s the code for your template. It should be place outside the loop (ie. before or after the main template loop):

    Code:

    Recent blog posts

    < ?php
    $numposts = 3; // number of posts to show
    if ($author = get_post_meta($post->ID, ‘author’, true)) :
    query_posts(“author=$author&post_status=publish&post_type=post&showposts=$numposts”);
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    ” title=”< ?php the_title(); ?>“>< ?php the_title(); ?>

    < ?php endwhile; endif;
    else: ?>

    This person doesn’t have a blog yet.

    < ?php
    endif; ?>

    # October 18, 2009 at 3:13 am

    [edit]Dave’s explanation is more in depth, so I’ll remove my little query_posts comment![/edit]

    # October 18, 2009 at 4:00 am

    Thank you davesgonebananas. But, how can I have the page I post use that page?

    # October 18, 2009 at 4:06 am

    You can create a page template – and assign it in the editor. Instructions can be found at http://codex.wordpress.org/Pages#Page_Templates

    # October 18, 2009 at 4:35 am

    Thank you, I noticed that if I had read your first post correctly the first time, I wouldn’t have had a problem..

    Thanks much. :D

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".