Jump to content


Photo
- - - - -

highlight a menu item if the post page displayed is from a certain category

menu post

Best Answer Rob , 25 March 2013 - 08:25 PM

Hi Hugo,

 

The only way to highlight a category when active would be to make the category the menu link as James suggests.  In that way, when you're on the category, it should remain highlighted, but any subcategory will not do that. I don't think a post within the category will keep the menu highlighted either, only being on the category page itself.

 

To customize this, you'll need either a plugin (if it exists) or, one of our Pro developers to help you write specific code to accomplish your goal.  Please see http://www.pagelines.com/pros.

Go to the full post


  • Please log in to reply
5 replies to this topic

#1 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 20 March 2013 - 05:13 PM

Hi all,

I would like to make something like: "highlight a menu item if the post page displayed is from a certain category"!

When I enter in a post I loose all highlights of the menu, because my posts don't reference any page.

So, if I enter in a post of Category A, can I highlight a certain menu item of my menu?

 

Thanks

 

Hugo



#2 James B

James B

    Advocate

  • Moderators
  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 21 March 2013 - 02:54 AM

Hi there,

 

I don't think you'll be able to do this easily.

 

The only way I can think of would involve using css based on the post id to highlight the menu item. That would mean that you would have to do this for every post you wrote, which would be very time consuming.

 

Is the menu item you're trying to highlight related to the content in anyway? Is it a link to a category page for example?



#3 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 21 March 2013 - 02:40 PM

Hi!

Yes, I have a menu with pages, and inside each page I have links to posts!

So would like to keep the menu item of the 'parent' page highlight when I enter the post.



#4 James B

James B

    Advocate

  • Moderators
  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 21 March 2013 - 08:46 PM

It would really depend on how you've set your menu up, is it using category links inside a custom menu?

 

If you can put up a live link to the page in question and tell us which items on the page you want to affect the menu we'll have a look into the code to see if this is possible.



#5 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 25 March 2013 - 04:54 PM

Hi,

no, I haven't set category links on the menu, only pages!

 

I'll put it online and will be back to you!

 

Thanks

 

hugo 



#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 25 March 2013 - 08:25 PM   Best Answer

Hi Hugo,

 

The only way to highlight a category when active would be to make the category the menu link as James suggests.  In that way, when you're on the category, it should remain highlighted, but any subcategory will not do that. I don't think a post within the category will keep the menu highlighted either, only being on the category page itself.

 

To customize this, you'll need either a plugin (if it exists) or, one of our Pro developers to help you write specific code to accomplish your goal.  Please see

Please Login or Register to see this Hidden Content

.