Jump to content
hugo2808

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

Recommended Posts

hugo2808    1
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    103
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    1
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    103
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    1
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    436
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    1
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    103
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    1
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    436
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    1
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

    • 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.
    • Jarek
      By Jarek+
      How to make the Impulse menu sticky?
      Here is a site that seems like it is doing just that: http://www.manhattanperiodontist.com/
      Here is the site I am working on: http://boeriu.digitalvector.com/ 
      I have no problem showing the menu at the bottom, but when scrolling up it does not stick.  I tried to add Nav Pro menu but when I do that, it just shows on top and no matter what I try is not working as I want it to.
      Any suggestions?
    • Dave
      By Dave+
      1) Toggle menu on mobile devices does not work properly, combination Chrome 56.0.2924.87 with Android 6.0.1

      2) Mobile / Default Menu > Set the primary/default navigation for your site. This will be used in the pop out mobile menu and as the default in navigation sections. Does not work.
    • David
      By David+
      We are building a long-page scrolling site with Pagelines 5. Our menu is made with # links that go to a container's unique ID, e.g. container_ux7al6g
      This works, but it doesn't look great in the menu. Is it possible to assign a 'nice' # link, e.g. /#solutions ? 
      We used to do this in the DMS2 platform through a workaround, but that doesn't seem to be possible now. 
      Any suggestions? 
    • Raju Gupta
      By Raju Gupta
      On Socrato.com I am using DMS 2 and few pages are showing the parent page in top navigation highlighted and some are not showing
      Overview and SAT are both pages under EXAMS show they are showing different behavior.


×