• #menu {width:900px;padding:3px 0px 0px; margin:0px}
    #menu ul {padding:0; margin:0px; list-style:none; text-align:right; font-size:12px}
    #menu li {display:inline-block; padding:4px 0px }
    #menu li a {color:#010413; text-decoration:none; padding:4px 10px; margin:0px;}
    #menu li a:hover {color:white; text-decoration:none; background:#010413}
    #menu li.current_page_item a {background:yellow;color:green}

    the current page link is not working, any ideas?

Viewing 9 replies - 1 through 9 (of 9 total)
  • I believe you are looking for current_page_parent rather than current_page_item(), which is a function you can call that returns either true or false. Also, not sure that background works with a, but not 100% sure on that.

    Thanks.

    Thread Starter xmatter

    (@xmatter)

    <div id="menu">
        <ul>
         <li><a href="https://www.sample.com/?page_id=4">home</a></li>
         <li><a href="https://www.sample.com/?page_id=8">sign up</a></li>
         <li><a href="https://www.sample.com/?page_id=2">about us</a></li>
         <li><a href="https://www.sample.com/?page_id=16">contact us</a></li>
        </ul>
       </div>

    here is the code that is in my header.php

    Is that hardcoded? If so, then the CSS class .current_page_parent will never be used.

    wp_list_pages() will list your pages and add the correct classes that are needed, whcih should then pick up your desired styling as above.

    Thanks.

    Thread Starter xmatter

    (@xmatter)

    ok, thanks! i didn’t want to use wp_list_pages but i guess it will. i’ll just have to add the “include” arg

    thanks agains

    No problem – WP list pages is very powerful. You can if you wish use it like this –

    $pages = wp_list_pages('echo=false');

    – so that the pages are not displayed by the function, but rather placed in a string. You can then manipulate that string as you please, should the need arise, before using echo $pages; – that way you get the power and the compatibility of the wp_list_pages() function and the convieniance and flexibility of a string.

    Thread Starter xmatter

    (@xmatter)

    since i have to use wp_list (which worked, so thanks) how to i specify the order in which the links display?

    using this:

    <?php wp_list_pages('title_li=&include=4,8,2,16');?>

    it displays the pages out of order. is there a way to specify an order and not alpha, or by page number or post title, but by the order from the above post. you can see the page id’s and names.

    Thanks

    Check out the WordPress Codex for wp_list_pages(), which will explain what all the arguments do (look for ‘sort_column’ and ‘sort_order’ in particular).

    Also, check out the ‘pageMash’ plugin. It offers an AJAX interface that allows you to drag and drop the pages in to any order you wish (look under the ‘Pages’ menu in the admin area), so then you don’t have to worry about the arguments.

    Thanks.

    Thread Starter xmatter

    (@xmatter)

    oh man, completely forgot about the page order number within each page. I really appreciate all your help and quick responses. setting page order worked as desired.

    I’d still recommend the ‘pageMash’ plugin, it will save you so much time if you ever need to rearrange the pages, or even add one slap bang in the middle!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘current_page_item a isn't working’ is closed to new replies.