• coha

    (@coha)


    Hi,

    We formatted the website so that a custom author would appear at every post. This has worked fine, but for some reason, at the beginning of every post where we do not add the “author” field, this comes up:

    Warning: Invalid argument supplied for foreach() in /home6/cohaorg/public_html/wp-content/themes/graphene/loop.php on line 88

    Here is the code in loop.php:

    <?php
    // Tue Aug 11 - fydk - Need to access custom 'Author' field instead of 'the_author()'
    $fydk_authorcustom = get_post_custom_values('Author');
    foreach ( $fydk_authorcustom as $authorkey => $authorvalue ) {
        if (in_category('102')) {
    		echo "Este análisis fue preparado por <b>$authorvalue</b> ";
    		}
    	else {
    	echo "This analysis was prepared by <b>$authorvalue</b> ";
    	}
    
    }?>

    Can you help us not get that error message when there is no custom author added?

    Thanks!

    Natalia

    [Please post code snippets between backticks or use the code button.]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    change here:

    $fydk_authorcustom = get_post_custom_values('Author');
    if( $fydk_authorcustom ) foreach ( $fydk_authorcustom as $authorkey => $authorvalue ) {
    Thread Starter coha

    (@coha)

    Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Author Name issue’ is closed to new replies.