machinetype
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: conditional inside loopWell 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.
Forum: Fixing WordPress
In reply to: Highlighting current postPlease 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>
Forum: Fixing WordPress
In reply to: Highlighting current postSorry 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.Forum: Fixing WordPress
In reply to: Highlighting current post/bump
Forum: Fixing WordPress
In reply to: Highlighting current postPosts