Jump to content
hugo2808

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

Recommended Posts

hugo2808

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 http://www.bienal-stp.org/exposicoes/

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

Share this post


Link to post
Share on other sites
catrina

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: http://support.pagelines.me/docs/customization/custom-css


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hugo2808

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

Share this post


Link to post
Share on other sites
catrina

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.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hugo2808

Hi Catrina,

in page http://www.bienal-stp.org/exposicoes/ 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="http://www.bienal-stp.org/exposicoes/">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="http://www.bienal-stp.org/exposicoes/">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="http://www.bienal-stp.org/exposicoes/">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="http://www.bienal-stp.org/exposicoes/">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?  

Share this post


Link to post
Share on other sites
James B

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

.page-id-407 .menu-item-356 {
background:white !important;
}

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
hugo2808

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

When I'm in http://www.bienal-stp.org/exposicoes/ I've got the menus highlighted,

but if i enter in one post http://www.bienal-stp.org/arquivo-reproducao-obra-2/ 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? 

Share this post


Link to post
Share on other sites
catrina

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.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hugo2808

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

Share this post


Link to post
Share on other sites
James B

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.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
hugo2808

Thanks,

I'll do it as suggested.

 

thank's a lot

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • Liv Kundalini
      By Liv Kundalini+
      Hi -
      Pulling my hair out over here, and would love an assist!
      Site I am building, http://www.livkundalini.com/home, has a problem with the submenu items in the nav not appearing. 
      If anyone wants to see what the Nav should look like, feel free to look in the footer on the left hand side.
      Have tried disabling Pagelines and using the twentyseventeen theme, but problem persists.
      Saw this error (pasted at the bottom of this post) displaying in the inspector, and saw discussion of Jetpack potentially being a culprit. Disabled Jetpack, but the problem persists.
      Had the hosting company even flush the server-side cache, but no avail.
      Any thoughts? Please? It's the only thing keeping me from launching this site!
      Many Thanks,
      Todd
       
      WebSocket connection to 'wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data' failed: Error during WebSocket handshake: Unexpected response code: 403   O @ (index):7
    • russe-intensif
      By russe-intensif+
      Hi team,
      checking my site today, i'm surprised to see my MegaNav all in bottom of the pages, while it's in header.
      After getting to change it in couple of pages onto Template part (too time consuming !), i'm desperate and ask you for help :-)
      apprendre-le-russe-avec-ania.fr
      Thank you in advance !

    • Borries
      By Borries+
      I know this is not an easy problem. Maybe there is a easy solution.
      I have tryed to uses the existing solution, that I have found in the forum
      I changed the colours of my nav (simple nav) and the hover effect (a. hover).
      I really tryed to highlight the active/used link in the nav but I cant figure it out.
      I want it to be black when active.
      Any help would be appreciated. Thanks.
      http://www.marcborries.de  nav link: "Sinn & Selbst" 
    • dwpoyner
      By dwpoyner+
      Not sure exactly what is causing the issue. For some reason, why you view my site on mobile, the menu does not show up. It will pop up, but it is black. You can check it out here: http://dev.caryfbc.org. I'm also attaching a screenshot where I shrunk my browser down. Any suggestions?

    • khat
      By khat+
      I think I may have installed pagelines pro incorrectly, and then used features incorrectly. I installed first platforms framework theme and then the child, thinking I could do setup for child later. I tried to set up a background image, and tried custom css feature in pagelines dashboard. I had mistakes in my css, and just thought that if I deleted the info in the css custom feature in pagelines dashboard that the new information would overwrite the old info. The background image didn't respond at all, probably because I didn't have the child directory renamed. I then tried to use the LSS plugin to create css and added more css, possibly, somewhere -sigh-. I never did change the background image and get it placed properly. I used a workaround and in nested containers I placed a background image which worked well enough, so I moved on to try to create my nav bar/ menu bar. When I go to the Menus panel, there is NO area where I can place a menu on a page. I have read and reread and re- re- reread the instructions for placing a menu. I've used the pagelines editor to place a menu, however only HOME shows up. I've been at this for many hours. I've since uninstalled all of my pagelines items and reinstalled, thinking that it would restore all my changes to default, but no, it is still all there, with all my unresolved issues. I am completely at a loss as to what to do next.
×