I want your help on my small test wordpress theme development self-training. I wish to create highlighting tabs in css much like http://www.countryqueenslandbookkeepers.com.au/ , I attempt designed a similar in wordpress through getting the need for page_id within the URL and compare it towards the publish ID. if it's equal, then echo ought to be "selected" otherwise "default". It really works fine , however, after i alter the permalink something similar to www.mydomain/%postname%/ , it does not work any longer.

How could i recieve the worthiness or how do i compare /%postname%/ to ensure that I possibly could echo "selected" to my link?

<?php 
        $all_posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE
                post_type = 'page' AND 
                post_status = 'publish'
                ORDER by ID ASC");  
        foreach ($all_posts as $post):
    ?> 
        <li class="<?php 
                        if($post->ID == $_GET['page_id']){
                            echo"selected";
                        }else{
                            echo "default";
                        }?>">
            <a href="<?php echo $post->guid; ?>"><?php echo $post->post_title; ?></a>
        </li>
    <?php endforeach; ?>    

You will want to make use of the CSS class .current-menu-item that is instantly put on every active food selection. Modify your look.cascading stylesheet accordingly and you will attain the highlighting effect. Please visit the WordPress Codex on Dynamic Menu Highlighting.

Use get_permalink rather. You pass within the publish id and also the permalink is came back. Also take a look at wordpress.stackexchange.com. Wordpress codex questions such as this are frequently clarified better there. Coding questions fare better here.

     <?php 
     if(get_permalink($post->ID) == currentURL){
           echo"selected";
     }else{
        echo "default";
     }?>">