Return to General talk

"Scroll to top" of page

Home Forums Graphene WordPress theme General talk "Scroll to top" of page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #715
    Anonymous

    Its sometimes slowly to “Scroll to top” of page in Graphene. (Read WP 🙂

    You can use footer.php to place a link eg. in <div id=”developer”>:

    <div id="developer">
    <p>
    <a href="#">=Scroll to top=</a>
    </p>
    <p>
    <?php /* translators: %1$s is the blog title, %2$s is the theme's name, %3$s is the theme's author */ ?>
    <?php printf(__('%1$s uses %2$s theme by %3$s.', 'graphene'), '<a href="' . get_home_url() . '">' . get_bloginfo('name') . '</a>', '<a href="http://www.khairul-syahir.com/wordpress-dev/graphene-theme">' . ucfirst(get_template()) . '</a>', 'Syahir Khairul'); ?></p>

    <?php do_action('graphene_developer'); ?>
    </div>

    Kim

    #13352
    Syahir Hakim
    Keymaster

    Better implementation using a child theme:

    Child theme’s functions.php file:

    function graphene_scroll_to_top(){ ?>
    <p id="scroll-to-top"><a href="#">=Scroll to top=</a></p>
    <?php
    }
    add_action('graphene_developer', 'graphene_scroll_to_top');

    And then style the link in CSS.

    This way, you won’t have to override the entire footer.php file, which is not recommended cause I may add new codes to the theme’s footer.php file in the future.

    #13353
    Kim
    Member

    Yes its better in functions.php.

    Thnx for the code.

    Kim

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.