WordPress.org

Ready to get started?Download WordPress

Forums

Two part question .htaccess and Back to Top (5 posts)

  1. homerm06
    Member
    Posted 5 years ago #

    I need to make an .htaccess file in my wp-admin folder. What do I need to add and how do I do that? I'm a newbie with that one.

    And how do I add a "Back to Top" link at the bottom of my posts? In my homepage I have 8 posts. I want to add a Back to top link next to where it says the comment number.. Is that possible?

    Thanks!

  2. Check out http://www.freewebmasterhelp.com/tutorials/htaccess/1

    Basically you're making a file named .htaccess - it's just like any other file.

    As for Back to Top, it's twofold.

    1. use an empty, named anchor somewhere near the top of the page (<a name="top"></a>)
    2. Make a link at the bottom of your post: <a href="#top">Back to Top</a>
  3. homerm06
    Member
    Posted 5 years ago #

    Ok I'll look into that .htaccess link later tonight.

    And as for the top deal. Is there a way to make it an automatic feature? I think that was too much to ask :) But thanks for you time and answers!

  4. Automatic .... Sure, just put it in your template.

    Put <a name="top"></a> in your header.php (right after the name of your blog should work).

    For your front page, edit your index.php and add <a href="#top">Back to Top</a> to the Loop section.

    Example:
    header.php
    <?php if(is_home()){bloginfo('name');} else {} ?><?php wp_title(); ?><a name="top"></a>

    index.php

    <div class="entry-content">
      <?php the_content('Continue Reading »'); ?>
      <?php wp_link_pages(); ?>
      <p class="postmetadata"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?> | <?php the_tags( '&nbsp;' . __( 'Tags ' ) . ' ', ', ', '|'); ?> <a href="#top">Back to Top</a> | <?php edit_post_link(__('Edit'), '', ' |'); ?>
    </div>

    The only reason I DON'T suggest actually using the top link as a link is that... well, a name will format that header as a link, and generally I don't want it to do that.

  5. homerm06
    Member
    Posted 5 years ago #

    Perfect! I'll do that! Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic