Forums

[resolved] Better php (2 posts)

  1. rikamus
    Member
    Posted 2 years ago #

    This may well not be the right place for this question, but it's worth a try. I've been playing around with having my site do this:

    <?php $author = get_the_author();
             if ( $author != 'admin' ) { print 'Guest blogged by <a href="'; echo get_author_link( false, $authordata->ID, $authordata->user_nicename ); print '" title="'; printf( __( 'View all posts by %s', 'themename' ), $authordata->display_name ); print '">'; the_author(); print '</a>'; }
    	 else { print 'something else' } ?>

    Regardless if that's the best way to do what I'm doing, is there a better way to code this? Coming in and out of print to include php stuff within the IF statement seems really long winded and messy.

    Thanks!

  2. rikamus
    Member
    Posted 2 years ago #

    Answered my own question by reading this article at Stack Overflow.

Topic Closed

This topic has been closed to new replies.

About this Topic