• Hello,

    I’ve written a custom field to display a link back to the image authors website as per copyright laws.

    I want it to only apply on pages and posts, and only if the custom field has a value assigned to it. It works perfectly on Posts but not on Pages.

    When it’s on a page, even one without a value assigned to that field, it automatically fills the value with the current pages url.

    This is my code:

    // Display Image Source
    add_action('genesis_entry_footer', 'image_source', 1 );
    function image_source() {
    if ( is_page() || is_single() && genesis_get_custom_field('imgsource') )
    echo '<div id="imagesource">Image Credit: <a href=" '. genesis_get_custom_field('imgsource') .'" target="_blank" rel="nofollow">Photo Artist</a></div>';
    }

    What have I done wrong?

    Thank you.

  • The topic ‘Checking custom field exists; where did I make a mistake?’ is closed to new replies.