WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Need Help With Multi-Author Site and Author Photos (WILL PAY) (13 posts)

  1. mdp8593
    Member
    Posted 7 years ago #

    I'm working on a site with multiple authors - over 30 - and I'm trying to avoid having to create a separate template for each author. It's at http://www.michaeldpollock.com/dev3

    The biggest problem I need to solve right now is how to show the author's photo on their author page. I want to show the author's photo in the side bar (outside the loop) on a page with all their posts.

    I'm using the Author Image plugin to pull author photos.

    I could set up a separate loop in the sidebar, but that gives me multiple copies of the author's photo and description.

    I managed to get the descrition to show up just once, but still haven't found a solution for the photo. Example.

    I could use some help on this project, and I'd be happy to pay anyone who can help me. PM me at savvysolo@gmail, and we can talk about it further, or if you have a sinple solution you're willing to volunteer on teh forum, please do.

    Thanks - Michael

  2. stuboo
    Member
    Posted 7 years ago #

    Michael,
    I'm certainly no php or wordpress genius but I'll offer my initial thoughts.

    If you don't need to be able to add authors dynamically, you could set up a swtich statment in the sidebar that prints the html for the photo depending on the userid.

    I'm sure that with a bit of phpFu you could ask wordpress for the userid and then pull the photo from the db so this would work on the fly too - thus bypassing the wp engine altogether.

    Hope this helps. There's also a good chance that I'm just talking out of my arse.

    Ryan

  3. jwurster
    Member
    Posted 7 years ago #

    I'm not sure exactly what you envision. Is it that you want to add the author's image next to their name whereever it appears or just in the sidebar? I looked at the author image plugin description and it looks like it would do what you want.

  4. mdp8593
    Member
    Posted 7 years ago #

    What I want is an author archive page ... a page with all the author's posts and their photo + description ONLY in the sidebar.

    The author image plugin has to be used INSIDE the loop, and when I do that, I get multiple copies of the author's photo (a copy for each post the author has created).

    Stuboo: That's exactly what I need to do. I need WP to display the author's photo dynamically, and my phpFu is too weak to figure out how to do it.

  5. jwurster
    Member
    Posted 7 years ago #

    How are you going to build the author archive page?

  6. Chris_K
    Member
    Posted 7 years ago #

  7. mdp8593
    Member
    Posted 7 years ago #

    HandySolo: I'll check those links, but I think I'll still have a problem with using the author photo OUTSIDE the loop. I need to tell WordPress to:

    1. get the current author id.
    2. display just 1 photo for that author id.
    3. then run the loop as normal showing all posts for that same author id.

    jwurtster: here's my author archive page:

    <?php get_header(); ?>
    <div id="page">
    <?php include (TEMPLATEPATH . '/sidebarleft.php'); ?>
    <div id="content">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="titleblock">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    </div>
    <div class="entry">
    <?php the_content() ?>
    </div>
    <div id="space1"></div>
    </div>
    <?php endwhile; ?>
    <div class="navigation">
    <div class="alignleft"><?php posts_nav_link('','','&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php posts_nav_link('','Next Entries &raquo;','') ?></div>
    </div>
    <?php endif; ?>
    </div>
    <?php include (TEMPLATEPATH . '/sidebarright.php'); ?>
    </div>
    <?php get_footer(); ?>

    Corrected. Thanks Moshu.

  8. moshu
    Member
    Posted 7 years ago #

    To display the code correctly, please, try to replace the apostrophe ['] with the "backticks" [`]
    On English keyboards it is usually somewhere on the top left, on the same key as the tilde [~].

  9. mdp8593
    Member
    Posted 7 years ago #

    Oddly enough, I managed to get the author photo to show up properly in the right sidebar with this code:

    <?php /* If this is a single post page */ if (is_single()) { ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div id="authordesc">
    <h2>About <?php the_author_firstname(); ?></h2>
    <p><?php the_author_description(); ?></p>
    <p>Contact <?php the_author_firstname(); ?> via email <a href="mailto:<?php the_author_email(); ?>">here</a>, visit <?php the_author_firstname(); ?> online <a href="<?php the_author_url(); ?>">here</a> or subscribe to <?php the_author_firstname(); ?>'s RSS feed <?php echo '<a href="' . get_author_link(0, $authordata->ID,
    $authordata->user_nicename) . 'feed/" title="Feed for posts by ' .
    wp_specialchars(the_author($idmode, false)) . '">' . here . '</a>.'; ?></p>
    </div>
    <?php endwhile; endif; ?>
    <?php echo ddpa_show_posts(); ?>
    <?php /* If this is an author archive page */ } elseif (is_author()) { ?>
    <div id="authordesc">
    <?php if(get_query_var('author_name')) : $curauth = get_userdatabylogin(get_query_var('author_name')); else : $curauth = get_userdata(get_query_var('author')); endif; ?>
    <h2>About <?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></h2>
    <p><?php c2c_the_author_image(); ?><p>
    <p><?php echo $curauth->description; ?> Contact <?php echo $curauth->first_name; ?> via email <a href="mailto:<?php echo $curauth->user_email; ?>">here</a> or online <a href="<?php echo $curauth->user_url; ?>">here</a>.</p>
    </div>
    <?php /* If this is a category page */ } elseif (is_category()) { ?>
    <?php if (have_posts()) : ?>
    <h2><?php echo single_cat_title(); ?></h2>
    <div class="catimage"><p><?php get_cat_icon(); ?></p></div>
    <?php add_filter('category_description', 'wpautop'); ?>
    <?php add_filter('category_description', 'wptexturize'); ?>
    <?php echo category_description(); ?>
    <?php $this_category = get_category($cat); ?>
    <!-- If category is parent, list it -->
    <?php if ($this_category->category_parent == 0) { ?>
    <?php $this_category->category_parent = $cat; ?>
    <p>Columns and categories within the <strong><?php echo single_cat_title(); ?></strong> section include:</p>
    <ul>
    <?php
    wp_list_cats('list=1&use_desc_for_title=0&child_of=' . $this_category->category_parent); ?>
    </ul>
    <?php } else { ?>
    <!-- If category is not parent, list parent category -->
    <?php $parent_category = get_category($this_category->category_parent); ?>
    <?php } ?>
    <?php endif; ?>
    <?php } ?>

    Any body have a clue why the exact same code won't work in in the LEFT sidebar?

    It has something to do with the right sidebar being after the loop. I know my client, and I'm sure she'll want it in the left sidebar unless I can talk her out of it.

    Thanks again - Michael

  10. PJ Brunet
    Member
    Posted 7 years ago #

    This is what I would do: "tag" (category) each post with the author's name. Then you can simply hack your category sidebar (in sidebar.php) to show the author's info/picture when looking at that particular category. Then you can hardlink to these category pages (with links or pictures) from anywhere on the site.

    If you need more help, hit me up at ferodynamics.com

    You could take this futher and show little author pictures in the boilerplate of each post (maybe derived from the category info). More tricky, but definitely possible.

  11. umair
    Member
    Posted 7 years ago #

    i think paid help is not allowed

  12. PJ Brunet
    Member
    Posted 7 years ago #

    Well, it should be. You can't solve everything with a few forum postings.

  13. markezz
    Member
    Posted 7 years ago #

    If I understood you correctly you just need the author id. Instead of your line 'if (is_author()) {' you could use 'if($uid = is_author()) {'. Then you get the user id of the author - even before the loop.
    --
    I know it's not applicable in this context, but if you like please check out this plugin (its the widget solution for the problem above): mAuthorWidget

    greetings, markezz

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags