Title: wired links, changes dynamicaly
Last modified: August 19, 2016

---

# wired links, changes dynamicaly

 *  Resolved [devric](https://wordpress.org/support/users/devric/)
 * (@devric)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/wired-links-changes-dynamicaly/)
 * Hi, i come up to a weird issue, look at the code below, the get_home_url and 
   the_category(‘7’), both these changes the link dynamically,
    eg: if im in a category,
   cat=4, get_home_url returns the link to cat=4, and the_category(‘7’) returns 
   the title of category4, and this behavior changes to the page according to whatever
   pages im in
 *     ```
       <li>
        <a href="<?php get_home_url(); ?>"><div class="menu">Home</div></a>
        <ul><?php wp_list_cats("exclude=7"); ?></ul>
       </li>
       <li>
        <div class="menu"><?php the_category('7'); ?></div>
       </li>
       ```
   
 * Anyone have any ideas how to fix it??
    thank you

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/wired-links-changes-dynamicaly/#post-1786222)
 * wp_list_cats is a deprecated function and the_category can only be used in the
   loop.
    try it with this:
 *     ```
       <li>
        <a href="/"><div class="menu">Home</div></a>
        <ul><?php wp_list_categories("exclude=7"); ?></ul>
       </li>
       <li>
        <div class="menu">
       <?php
       $category_id =7;
       $category_link = get_category_link( $category_id ); ?>
       <!-- Print a link to this category -->
       <a href="<?php echo $category_link; ?>" title="Category Name">Category Name</a>
       </div>
       </li>
       ```
   
 *  Thread Starter [devric](https://wordpress.org/support/users/devric/)
 * (@devric)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/wired-links-changes-dynamicaly/#post-1786230)
 * Thanks kee!! solved the issue of category links
 * however, the home link ‘/’ gets to the root directory, not the installation folder.
   how do i get to the installation folder?
 * Thanks
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/wired-links-changes-dynamicaly/#post-1786231)
 * change this:
 *     ```
       <a href="/"><div class="menu">Home</div></a>
       ```
   
 * to this:
 *     ```
       <a href="<?php echo home_url(); ?>"><div class="menu">Home</div></a>
       ```
   
 *  Thread Starter [devric](https://wordpress.org/support/users/devric/)
 * (@devric)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/wired-links-changes-dynamicaly/#post-1786233)
 * nice thanks again Kee!
 * the echo home_url works!!, i guess the get_home_url is deprecated too huh

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wired links, changes dynamicaly’ is closed to new replies.

## Tags

 * [link](https://wordpress.org/support/topic-tag/link/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [devric](https://wordpress.org/support/users/devric/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/wired-links-changes-dynamicaly/#post-1786233)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
