Home Forums Add-ons Options Page Alt text for get_field function


Alt text for get_field function

  • I am quite confused and would appreciate if someone could help me.

    function get_logo()
    	$logoUrl = get_field('logo', 'option');
    	if (is_product_category()) {
    		$term = get_queried_object();
    		if (getMainParent($term) == 'men') {
    			$logoUrl = get_field('logo_men', 'option');
    		} elseif (getMainParent($term) == 'juvia') {
    			$logoUrl = get_field('logo_juvia', 'option');
    	} else {
    		$logoUrl = get_field('logo', 'option');
    	return $logoUrl;

    I got this function to display a logo, whenever the visitor is in a specific category area.

    And i display it in the header.php like this:

     <a class="logo" href="<?php echo get_site_url() ?>">
                            <?php $logo = get_logo(); ?>
                            <img src="<?php echo get_logo(); ?>" alt="<?php echo $logo['alt']; ?>">

    It is displaying the logo fine, i am returning the image array. But somehow it doesn’t display the alt text correct, it just displays “h”. Maybe someone else got the solution.

    Kind regards

  • Can you double check what your function is returning and post the results

    $logo = get_logo();
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.