user2751645
user2751645

Reputation: 65

Trying to use ACF Options Page in Genesis to output a Image Logo

I have created an options page in ACF Pro and Have added a image field called company logo. Now I want to remove the genesis site title. I have genesis removing the site title but when i add in the ACF call it does not work. If someone can take a look at what I have and give me some advice that would be great.

    remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
add_action( 'genesis_site_title', 'child_seo_site_title' );

/* Then add logo to header. */
function child_seo_site_title() {
$logo = get_field('company_logo', 'option');

    if($logo) {
        $output .= "<img src='". $logo['url']."' alt='". $logo['alt'] ."' />";
    }
} 

Should be simple but can seem to get it to work.

Upvotes: 0

Views: 300

Answers (1)

Nathan Dawson
Nathan Dawson

Reputation: 19308

You're appending the image to an undefined variable, $output, and then doing nothing with it.

Output the image instead:

function child_seo_site_title() {
    $logo = get_field( 'company_logo', 'option' );

    if ( $logo ) {
        echo '<img src="' . $logo['url'] . '" alt="' . $logo['alt'] . '" />';
    }
} 

Upvotes: 1

Related Questions