• Resolved devric

    (@devric)


    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

    (@keesiemeijer)

    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

    (@devric)

    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

    (@keesiemeijer)

    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

    (@devric)

    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.