Jump to content


Photo
- - - - -

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

menu highlight post page

Best Answer James B , 24 April 2013 - 08:15 PM

Hi Hugo,

 

That could be a possibility but unfortunately that type of customization would be outside of our support spectrum. So we wouldn't be able to advise you how to achieve it directly, you'd need to either look into a php solution or contact one of the pagelines pros at www.pagelines.com/pros/ to make the required modifications.

Go to the full post


  • Please log in to reply
11 replies to this topic

#1 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 22 April 2013 - 02:34 PM

Hi all,

I've a problem in associate pages with menu items.

 

In the page www.bienal-stp.org a have post references in page

Please Login or Register to see this Hidden Content

In this page, main menu "Exposições" and left menu "7ª Bienal" are highlighted, but when I enter in one post listed I loose both menus highlight.

How can I do something like "highlight a menu item if the post page displayed is from a certain category" ??

 

Thanks

 

Hugo



#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 22 April 2013 - 04:44 PM

To keep the menu item highlighted, you need to use custom CSS and include the selector for that one category item (the selector used when the category item is in its active state). Before getting into those specifics, please review this entire documentation first so you can get a general idea of how the CSS needs to be implemented:

Please Login or Register to see this Hidden Content



#3 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 22 April 2013 - 05:41 PM

I use pagelines-customize plugin, and I have customize the menus in his style.css file.

The question is how I can activate it by category has you said.

 

Thanks

 

Hugo Dias



#4 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 22 April 2013 - 06:14 PM

Using Firebug, select the active category link in your menu. When you look at the class for it, should have a class with the word "current" in it. Once you've found it, please take a screenshot of the Firebug window with the code in it and post it here.



#5 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 23 April 2013 - 03:11 PM

Hi Catrina,

in page 

Please Login or Register to see this Hidden Content

 I have 2 menus (the main and the left bar) and they both highlight on this page.

 

<li id="menu-item-458" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-451 current_page_item menu-item-458">
<a href="

Please Login or Register to see this Hidden Content

"
>Exposições</a>
</li>

 

and

 

 

<li id="menu-item-581" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-451 current_page_item menu-item-581">
<a href="

Please Login or Register to see this Hidden Content

"
>7ª Bienal</a>
</li>

 

On this page I have a list of post displayed with Special Recent Posts plugin. When I enter in one post I loose all references to menus:

 

<li id="menu-item-458" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-458">
<a href="

Please Login or Register to see this Hidden Content

"
>Exposições</a>
</li>

 

and

 

 

<li id="menu-item-581" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-581">
<a href="

Please Login or Register to see this Hidden Content

"
>7ª Bienal</a>
</li>

 

 

Is there any way to force the css of menu item to highlight although the post hasn't any reference to none menu?  



#6 James B

James B

    Advocate

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

Posted 23 April 2013 - 09:12 PM

Hi there,

 

You could force the certain items in the menu to display the active color on a certain page, you'd need to use page specific css so when on that page, you'd have certain items in the menu showing the active color by targeting the menu li class.

 

An example of this is

Please Login or Register to see this Hidden Content



#7 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 24 April 2013 - 03:21 PM

Hi, the problem is when I enter in one post.

When I'm in 

Please Login or Register to see this Hidden Content

 I've got the menus highlighted,

but if i enter in one post 

Please Login or Register to see this Hidden Content

 i loose the highlights!!

 

I don't have the posts in the menu, only the pages.

Is there any possibility to highlight a menu item if I'm in a certain post by is category? 



#8 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 24 April 2013 - 03:25 PM

I just checked the structure of the code, and I don't think it is possible after all. It'd only be possible with parent pages and their subpages (not categorie pages and their post pages).

 

Plus, if it were possible, you'd need to create CSS code manually for each post that's published.



#9 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 24 April 2013 - 03:40 PM

I don't have PHP development experience, but is any possibility of creating a function in pagelines-customize functions.php

that makes something like:

 

if current-displayed-post in_category( 'mycat' )

   apply css to menu item

 

 

Thanks

 

Hugo



#10 James B

James B

    Advocate

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

Posted 24 April 2013 - 08:15 PM   Best Answer

Hi Hugo,

 

That could be a possibility but unfortunately that type of customization would be outside of our support spectrum. So we wouldn't be able to advise you how to achieve it directly, you'd need to either look into a php solution or contact one of the pagelines pros at www.pagelines.com/pros/ to make the required modifications.



#11 hugo2808

hugo2808

    Advanced Member

  • Members
  • 42 posts
  • Country: Country Flag

Posted 02 May 2013 - 02:57 PM

Thanks,

I'll do it as suggested.

 

thank's a lot



#12 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 02 May 2013 - 03:24 PM

No problem!







Also tagged with one or more of these keywords: menu, highlight, post page