Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 27, 2012, 04:48 PM   #1
definitive
macrumors 65816
 
Join Date: Aug 2008
WordPress question regarding Categories and Posts.

I'm currently trying to make a menu on a page which would display a vertical list of four items. These items are post names which belong to a category named "name_of_menu".

Here's the code for the loop so far:

Code:
<ul>
<?php $posts = get_posts( "category_name=name_of_menu&numberposts=4&orderby=date&order=ASC" ); foreach($posts as $post) : ?>

<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
What I'm trying to do is have the active page's (since these 4 items will be repeated across the 4 pages) hyperlink be a different color from the rest.

If I use something like

Code:
.current_page_item > a,
.current-post-ancestor a,
.current_page_ancestor > a {
	color: #aabbcc;
}
and add the class to the <li> in the code above, then it makes all the topic hyperlinks that color instead of the active page's. I also tried

Code:
<li><?php if (is_home()){echo " class="current_page_item";}?>>
as well, but that doesn't work correctly either.

Anyone ever deal with this issue before and could provide some help?
definitive is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Embed Wordpress posts on website. Springsteen Web Design and Development 0 Dec 31, 2013 07:40 AM
Wordpress and categories (simple question?) definitive Web Design and Development 2 Nov 21, 2013 10:40 AM
Need help with inserting Images in Wordpress(basic html question) Arkados Web Design and Development 7 Aug 4, 2013 02:01 AM
Question about file permissions in WordPress olup Web Design and Development 2 May 17, 2013 12:32 PM
Simple WordPress question. definitive Web Design and Development 1 Jan 22, 2013 07:52 AM

Forum Jump

All times are GMT -5. The time now is 01:49 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC