• Resolved DancingFighterG

    (@dancingfighterg)


    Hello, I had a function made that would put an image in the footer but now I need the back to top button to available as well. The current custom filter that I use now removes the back to top button.

    add_filter('tc_colophon_right_block', 'my_image');
    function my_image(){
    	$img_url = get_stylesheet_directory_uri().'/imgs/hdfooterlogo.png'; //put your image in child-theme/imgs
    	$width = '250px';
    	$height = '79px';
    	$img = '<a href="https://www.hunterdouglas.com/"><img alt="logo" src="'.$img_url.'" width="'.$width.'" height="'.$height.'" class="pull-right"></a>';
    	return '<div class="span4 right-image">'.$img.'</div>';
    	}
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter DancingFighterG

    (@dancingfighterg)

    Currently I took out this function to show the Back to Top link but I just need to get the image in place again

    Thread Starter DancingFighterG

    (@dancingfighterg)

    Currently I have the following custom css in place:

    .back-to-top {
        position: fixed;
        bottom: 20px;
        right: 10px;
        z-index:250;
    }
    Thread Starter DancingFighterG

    (@dancingfighterg)

    Ok, so I was able to get the image and back to top link to exist in same span by moving the logo to the tc_colophon_left_block and having the back to top link to occupy the tc_colophon_right_block. I would still like to figure out how to have both of them exist in the same block.

    Thread Starter DancingFighterG

    (@dancingfighterg)

    Ok, I’ve been trying for the longest to get this code to work but I am having some issues:

    add_filter('tc_colophon_right_block', 'my_imageandtop');
    function my_imageandtop(){
    	$img_url = get_stylesheet_directory_uri().'/imgs/hdfooterlogo.png'; //put your image in child-theme/imgs
    	//$backtop =  sprintf('<div class="%1$s"><p class="pull-right"><a class="back-to-top" href="#">%2$s</a></p></div>', 'Back to Top');
    	$width = '250px';
    	$height = '79px';
    	$img = '<a href="https://www.hunterdouglas.com/" target=_blank><img alt="logo" src="'.$img_url.'" width="'.$width.'" height="'.$height.'" class="pull-right"></a>';
    	return '<div class="span4 right-image"> '.$img.' </div>';
    	}

    I just answered this on your other thread.

    Thread Starter DancingFighterG

    (@dancingfighterg)

    I have the following code working to place an image in the right block

    add_filter('tc_colophon_right_block', 'my_imagetop');
    function my_imagetop(){
    	$img_url = get_stylesheet_directory_uri().'/imgs/hdfooterlogo.png'; //put your image in child-theme/imgs
    	$width = '250px';
    	$height = '79px';
    	$img = '<a href="https://www.hunterdouglas.com/" target=_blank><img alt="logo" src="'.$img_url.'" width="'.$width.'" height="'.$height.'" class="pull-right"></a>';
    	return '<div class="span4 right-image">'.$img.'</div>';
    	}

    Now I’m trying to if I can have the back to top link and the image be in the same right block. When I try to do it the image overrites the back to top link. Here is the link that I want to add:

    sprintf('<div class="%1$s"><p class="pull-right"><a href="#">%2$s</a></p></div>)

    I see in the function.php for the base theme that there is a function for the back-to-top. I’ve been trying to use the html in there to get it to show up in this custom function but I’m not having any luck

    Thread Starter DancingFighterG

    (@dancingfighterg)

    Ok, figured it out:

    add_filter('tc_colophon_right_block', 'my_imageandtop');
    function my_imageandtop(){
    	$img_url = get_stylesheet_directory_uri().'/imgs/hdfooterlogo.png'; //put your image in child-theme/imgs
    	$backtop = '<div class="span4 backtop"><p class="pull-right"><a class="back-to-top" href="#">Back to top</a></p></div>';
    	$width = '250px';
    	$height = '79px';
    	$img = '<a href="https://www.hunterdouglas.com/" target=_blank><img alt="logo" src="'.$img_url.'" width="'.$width.'" height="'.$height.'" class="pull-right"></a>';
    	return '<div class="span4 right-image"> '.$img.' </div> <div class="span4 right-backtop"> '.$backtop.' </div> ';
    	}

    The main thing from the hooks article is the fact that I needed to use standard html in the variables.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Back to Top link in footer or page’ is closed to new replies.