Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1119082

    Hi
    I have added this code to functions.php but it’s not working.
    add_filter(‘avf_logo_alt’, ‘avf_change_logo_alt’);
    function avf_change_logo_alt($alt) {
    global $post;

    if(is_product()){
    $terms = get_the_terms( $post->ID, ‘product_cat’ );
    foreach($terms as $term){
    $ids[] = $term->term_id;
    }

    if(in_array(“176”, $ids)){
    $alt = ‘Leeds Art Gallery’;
    }elseif(in_array(“177”, $ids)){
    $alt = ‘Leeds City Museum’;
    }elseif(in_array(“178”, $ids)){
    $alt = ‘Lotherton’;
    }elseif(in_array(“179”, $ids)){
    $alt = ‘Temple Newsam’;
    }elseif(in_array(“180”, $ids)){
    $alt = ‘Kirkstall Abbey’;
    }elseif(in_array(“181”, $ids)){
    $alt = ‘Abbey House Museum’;
    }elseif(in_array(“182”, $ids)){
    $alt = ‘Leeds Discovery Centre’;
    }elseif(in_array(“183”, $ids)){
    $alt = ‘Leeds Industrial Museum’;
    }elseif(in_array(“184”, $ids)){
    $alt = ‘Thwaite Watermill’;
    }
    }else{
    if ($post->post_parent) {
    $ancestors=get_post_ancestors($post->ID);
    $root=count($ancestors)-1;
    $parent = $ancestors[$root];
    } else {
    $parent = $post->ID;
    }

    $terms = wp_get_post_terms( get_the_ID(), ‘event-categories’);
    foreach($terms as $struct){
    $item = $struct->term_id;
    }

    if($parent == 288 || $item == 28){
    $alt = ‘Lotherton.png’;
    }elseif($parent == 291 || $post->post_parent == 1369 || $item == 26){
    $alt = ‘Temple Newsam’;
    }elseif($parent == 280 || $item == 22){
    $alt = ‘Leeds Art Gallery’;
    }elseif($parent == 184 || $item == 123){
    $alt = ‘Kirkstall Abbey’;
    }elseif($parent == 70 || $item == 17){
    $alt = ‘Abbey House Museum’;
    }elseif($parent == 283 || $item == 25){
    $alt = ‘Leeds City Museum’;
    }elseif($parent == 93 || $item == 164){
    $alt = ‘Leeds Discovery Centre’;
    }elseif($parent == 104 || $item == 18){
    $alt = ‘Leeds Industrial Museum’;
    }elseif($parent == 293 || $item == 166){
    $alt = ‘Thwaite Watermill’;
    }
    }
    $alt =’testttt’;
    return $alt;
    }

    I am using transparency header for different pages. I have tried this code too
    add_filter(‘avf_logo_alt’, ‘avf_change_logo_alt’);

    function avf_change_logo_alt($alt) {
    $alt = “New Alternate Text Here”;
    return $alt;
    }

    • This topic was modified 5 years, 5 months ago by davealexander.
    #1119815

    Hey Dave,

    Thank you for using Enfold.

    That filter is intended for the default logo. It’s not going to change the markup of the transparent logo. For the transparent logo, you may need to change the markup or value of the $sub variable using the “avf_logo_final_output” filter. The $sub variable holds the markup of the transparent logo. An example can be found here:

    // https://kriesi.at/support/topic/how-to-change-header-logo-link-based-on-user-role/#post-1109309

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.