Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a wordpress site based on the Thematic framework which has a static Home page, a Blog page (posts) and a News page displaying a custom post type named 'news'. My attempt to highlight the current menu item is as follows:

.aside .current-custom-item a, .aside .current-menu-item a, .aside .current-menu-parent a, .aside .current-menu-ancestor a, .aside .current-post-ancestor a, .aside .current_page_item a, .aside .current_page_ancestor a, .aside .current_page_parent a { color:#00f; }

I created the News page as follows:

1) Copied template-page-blog.php from Thematic to my Child Theme folder and renamed to template-page-news.php.

2) Edited the comment at the top of the file to:

/** * Template Name: News * * This template allows you to display the latest news posts on any page of the site. * */

3) Edited the query in the file to:

$wp_query->query( array( 'posts_per_page' => get_option( 'posts_per_page' ), 'paged' => $paged, 'post_type' => array('news', 'attachments') ) );

This all works fine except when on the News page, the 'Blog' menu item is highlighted rather than the 'News' menu item!

It seems like what is missing is some way of 'telling' my news page template that it is not the main posts page but a custom post type page... This is my first WordPress and Thematic site so I could have missed something basic here!

Thanks in advance for any help. 8-)

share|improve this question
Paste the code relevant to the menu, how is it built? – soulseekah Oct 21 '11 at 18:29
The menu is built using Appearance->Menus in the WordPress dashboard. – michaelH Nov 4 '11 at 12:21

closed as too localized by toscho Jul 19 '12 at 23:36

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

I had the same issue on a theme I was working on. The deal is if you want the "News" menu to stay highlighted when you are looking at a single News item you have to: Create a file called archive-new.php and design it however you like, but for displaying a list of your News items..so something like:

  <?php query_posts('post_type= news','showposts=20'); ?>

Create a file called single-news.php and develop that to show a single post:

<?php if(have_posts()): ?><?php while(have_posts()):the_post(); ?>

and then your menu item for News can just be whatever your permalink to the News posts is set to, which will get directed to that archive-news.php page, and clicking on a single News item will get directed to that single-news.php page, and your menu will know to stay highlighted for News.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.