get_the_ID()-function
-
Hi!
Could somone help me out here? I want to put the class “selected” on the<a>
-tag only on the post that is active.I tried with this code, but it looks like somthing is wrong about the get_the_ID()-function…
<ul> <?php global $post; $p = $_GET['p']; $myposts = get_posts('category=1'); foreach($myposts as $post):?> <li> <a href="<?php the_permalink();?>" <?php if($p == get_the_ID()) {echo ' class="selected"';}?>> <?php the_title();?></a> </li> <?php endforeach;?> </ul>
- The topic ‘get_the_ID()-function’ is closed to new replies.