• Hello !

    I tried to set an anchor from the menu placed in the header with several categories.
    When I click on these, I want the page be placed automatically to the matching article.

    In the header.php, I placed this excerpt of code :

    <a href="debut"><?php wp_list_cats('sort_column=name&hierarchical=1') ?></a>

    and in the category.php :

    <a name="debut" id="debut"><div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class(); ?>"></a>

    Many thanks for your help !

Viewing 3 replies - 1 through 3 (of 3 total)
  • <a href="debut"><?php wp_list_cats('sort_column=name&hierarchical=1') ?></a>
    You cannot do that…

    Thread Starter badiou

    (@badiou)

    Actually, I can’t.
    There’s no solution ?

    Let’s get back to the basics…
    1. For WP 2.3.3 – that’s the wrong template tag, it has been deprecated! see > Template_Tags/wp_list_cats
    2. You should check your source code to see what the output of that tag is:
    it is a list of all your categories like

    <li class="categories"><h2>Categories</h2>
    <ul>
    <li class="cat-item cat-item-5"><a href="http://example.com/category/whatever/" title="View all posts filed under Whatever">Whatever</a>
    </li>
    <li class="cat-item cat-item-4"><a href="http://example.com/category/another/" title="View all posts filed under Another">Another</a>
    </li>
    	<ul class='children'>
    	<li class="cat-item cat-item-3"><a href="http://example.com/category/another/its-child/" title="View all posts filed under Its Child">Its Child</a>
    </li>

    3. Now, what you did: you placed an anchor tag around the WHOLE list above… which is nonsense. Do you see it now?

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

The topic ‘Anchor from the navigation menu’ is closed to new replies.