-
AuthorPosts
-
September 11, 2017 at 8:18 am #850377
Hi Ismael,
I just saw that this thread is unfortunately not resolved :-( . Because setting the “Blog” page as blog and adding a filter to remove the “Blog” link from the breadcrumb makes all categories menu items jumping back to blog again.
So, for example, when selecting a post from Masonry under menu item “Recipes”, the active menu indicator jumps from menu item “Recipes” to “Blog”. That is why I did not set “Blog” as blog page, because this way the indicator does not jump, but instead double “Blog” is displayed in breadcrumbs. For better understanding, please see screenshots via Dropbox in private content attached.
Please urgently help. Thanks a lot in advance.
Best regards
SophieSeptember 11, 2017 at 9:58 pm #850686Hey Sophie,
I am sorry but I could not understand.
Do you have the site active somewhere so we can take a look?Best regards,
BasilisSeptember 12, 2017 at 1:38 pm #850988Hi Basilis,
not a problem, I will explain again and also send you the login details in private content since my website is still in maintenance mode and not online yet.
In my main menu I have (among others) the pages “Recipes”, “Lifestyle” and “Blog”. And all these pages use your ALB Masonry Element with category posts. So, when clicking on the menu item “Recipes”, the page opens with all the recipe posts. Now when clicking on a post, the single recipe post opens and the (green) active menu indicator jumps from menu item “Recipes” to “Blog”. But the active menu indicator should stay stuck to the menu item “Recipes” instead of “Blog” (because it’s a recipe and not a blog post).
With Ismaels code, the breadcrumbs look okay now, but the menu does not work anymore as before. When deselecting the “Blog” page as blog, then no menu indicator is displaying.
I hope this helps and I am really looking forward to hearing from you.
Best regards
SophieSeptember 14, 2017 at 5:54 am #851822Hi,
That is to be expected since the “recipe” posts are technically just blog posts. If you want to exclude the recipe posts from the default blog posts, apply a unique category to them (e.g “recipes” ). Add this filter in the functions.php file.
add_filter( 'body_class', function( $classes ) { if( is_single() && has_category( 'rezepte' ) ) { $classes = array_merge( $classes, array( 'single-recipe' ) ); } return $classes; });
Add the following css code in the Quick CSS field.
.single-recipe #menu-item-450 .avia-menu-fx { display: none !important; } .single-recipe #menu-item-480 .avia-menu-fx { display: block; opacity: 1; visibility: visible; }
The indicator of the “Rezepte” menu item will be displayed if you visit a recipe item or post.
Best regards,
IsmaelSeptember 14, 2017 at 6:22 am #851839Hi Ismael,
thank you for your fast reply. I will test it and let you know. Can I make it with the indicator of the “Lebensart” menu item as well, because the “lebensart” posts are also technically just blog posts? If so, would you give me the code as well?
Oh, then everything would be so perfect :-) !
Have a great day, Isamel!
Kind regards
SophieSeptember 14, 2017 at 9:02 am #851921Hi,
Yes, that is possible. Please give us the slug or name of the category that you’re going to apply so that we can adjust the filter and the css codes.
Best regards,
IsmaelSeptember 14, 2017 at 10:03 am #851953Hi Ismael,
to the recipe post I set the parent category to “Recipes” and subcategory to “Icecreams” (please screenshots in private content box). Then I added your a/m code to functions.php and your a/m CSS code in the Quick CSS field. But nothing changed, the recipe post still jumps to blog menu item :-( .
The other (parent) category name is “lebensart” (in English lifestyle), please kindly see screenshot attached as well.
Don’t know what I am doing wrong here. Your help is really appreciated. Thanks so much in advance.
Kind regards
SophieSeptember 15, 2017 at 9:52 am #852436Hi,
Please edit the filter in the functions.php file. You have to replace the “has_category” function value from “recipes” to “rezepte”.
Best regards,
IsmaelSeptember 16, 2017 at 12:25 pm #852858Hi Ismael,
that is awesome! I changed it and it really does work :-) ! Thank you so much for your help. Can you just help regarding the other parent category “lebensart”?
Thanks again!!!!
Kind regards
SophieSeptember 19, 2017 at 6:39 am #853708Hello,
Glad it is working. Please replace the filter with the following.
add_filter( 'body_class', function( $classes ) { if( is_single() && has_category( 'rezepte' ) ) { $classes = array_merge( $classes, array( 'single-recipe' ) ); } if( is_single() && has_category( 'lebensart' ) ) { $classes = array_merge( $classes, array( 'single-lebensart' ) ); } return $classes; });
Add the following css code.
.single-lebensart #menu-item-450 .avia-menu-fx { display: none !important; } .single-lebensart #menu-item-481 .avia-menu-fx { display: block; opacity: 1; visibility: visible; }
Regards,
IsmaelSeptember 19, 2017 at 1:52 pm #853843Hi Ismael,
that is so awesome! You can’t imagine how happy you made me with this kind of support! Thank you so much. All is working fine now :-) !
Thanks a lot again! I think you can close this topic out now ;-) !
Kind regards
Sophie -
AuthorPosts
- The topic ‘Menu and category menu items issues’ is closed to new replies.