Lego2012
12/13/2016 - 4:59 PM

Go to top

Go to top

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

//* Create a shortcode to display custom Go to top link
add_shortcode('footer_custombacktotop', 'set_footer_custombacktotop');
function set_footer_custombacktotop($atts) {
    return '
        <a href="#" class="top">Return to top of page</a>
    ';
}

//* Add smooth scrolling for any link having the class of "top"
add_action('wp_footer', 'go_to_top');
function go_to_top() { ?>
    <script type="text/javascript">
        jQuery(function($) {
            $('a.top').click(function() {
                $('html, body').animate({scrollTop:0}, 'slow');
                return false;
            });
        });
    </script>
<?php }

//* Change the footer text
add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
function sp_footer_creds_filter( $creds ) {
    $creds = '[footer_copyright] &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a> &middot; [footer_wordpress_link] &middot; [footer_loginout] &middot; [footer_custombacktotop]';
    return $creds;
}