Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter machinetype

    (@machinetype)

    Well I have links on the sidebar that are links to posts. The posts are assigned a class based on which page they are on. Like if your on page 3, the link for page 3 has a white bg applied to it.

    If theres another way to make accomplish this, let me know.

    Thread Starter machinetype

    (@machinetype)

    Please mark this as solved. I have found the solution.

    I just added a css property to match the post id


    <style type="text/css">
    #post-<?php the_ID(); ?> {
    background-color: #FFFFFF;
    }
    </style>
    <li class="post-<?php the_ID(); ?>">
    <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
    </li>

    Thread Starter machinetype

    (@machinetype)

    Sorry about bumping to quick.

    To elaborate, here is the code Im using to output the posts.

    <? $pageid="post-<?php the_ID(); ?>"; ?>
    <ul>
    <?php $lastposts = get_posts('numberposts=20'); foreach($lastposts as $post) : setup_postdata($post); ?>
    <li>
    <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
    </li>
    <?php endforeach; ?>
    </ul>

    All I basically want is to have a css class applied to the list. Ive tried the following below.

    <? $pageid="post-<?php the_ID(); ?>"; ?>
    <ul>
    <?php $lastposts = get_posts('numberposts=20'); foreach($lastposts as $post) :
    setup_postdata($post); ?>
    <li <? if("post-<?php the_ID(); ?>"==$pageid){echo 'id="current"';}?>><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    The problem with this is that all outputed links are highlighted.

    Thread Starter machinetype

    (@machinetype)

    /bump

    Thread Starter machinetype

    (@machinetype)

    Posts

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