WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Looping through each author for theme (4 posts)

  1. adam8797
    Member
    Posted 1 year ago #

    This is the author block that my theme provides:

    <?php if (option::get('post_authorbio') == 'on') { ?>
    				<div class="post_author">
    					<?php echo get_avatar( get_the_author_meta('ID') , 70 ); ?>
    					<span><?php _e('Author:', 'wpzoom'); ?> <?php the_author_posts_link(); ?></span>
    					<?php the_author_meta('description'); ?><div class="clear"></div>
    				</div>
    			<?php } ?>

    I have been trying for a while and all I end up with are 500 Errors..... I dont know PHP at all.

    Any help would be appreciated. All I need to do is repeat that div for each author.

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. adam8797
    Member
    Posted 1 year ago #

    ok, so i figured it out but I have a problem

    Here is the code

    <?php if (option::get('post_authorbio') == 'on') { ?>
    	<?php $i = new CoAuthorsIterator(); ?>
    	<?php
    		while($i->iterate()){
    			print "<div class='post_author'>";
    			print get_avatar( get_the_author_meta('ID') , 70 );
    			print "<span>" + _e('Author:', 'wpzoom') + "HELLO THERE" + the_author_posts_link() + "</span>";
    			print the_author_meta('description');
    			print "<div class='clear'></div></div>";
    		} ?>
    <?php } ?>

    which works fine, but adds a zero to the end of each name.
    Produces: http://imgur.com/TegPI

    This one has got me stumped.

  3. boxcarpress
    Member
    Posted 1 year ago #

    PHP uses "." to concatenate strings, not a "+". You're doing some addition where you mean to concatenate the <span> to the_author_posts_link(). :)

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Thanks boxcarpress!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.