Tagged: child themes, menu
-
AuthorPosts
-
April 17, 2014 at 3:02 pm #252727
I’d like to add static text, a text input box, and a submit button to the right of the social icons in the menu and have them all work well with the theme. I’m developing a child theme, and I see where the ava_after_main_menu hooked functions are called in the main theme, but this is outside of the main navigational tags. Of course, I’d like the elements I add to be styled just like the other menu items.
Any advice or recommendations?
April 18, 2014 at 11:43 am #253115Hi Jonathan!
Thank you for using the theme.
Instead of using the ava_after_main_menu hook use the avia_meta_header action hook. You can use this on functions.php
add_action('avia_meta_header', 'avia_add_forms_on_header'); function avia_add_forms_on_header() { echo '<li class="avia-form-header">DO SOMETHING HERE</li>'; }
I added the list tag to align the new element correctly.
Regards,
IsmaelApril 18, 2014 at 1:28 pm #253140Hi Ismael,
I tried your approach but I am not seeing any additional items in the menu at all – nor is the new HTML being output into the stream.
Some conditional is preventing the calling block of code to be executed. Any ideas?
FYI, what I’d like to end up with is something similar to the box in the upper right corner of my current site (https://web.archive.org/web/20140331064238/http://www.jpollackphoto.com/).
Thanks for your help,
Jonathan- This reply was modified 10 years, 8 months ago by jpollackphoto. Reason: Traced execution
April 18, 2014 at 4:19 pm #253220Something else I tried…
I got the code to execute by adding it as an action to ava_after_main_menu, but that falls outside of the nav tag. If I open another nav tag and build a separate nav menu, it overlaps the right-aligned other nav tag present.
JonathanApril 19, 2014 at 5:12 am #253420I managed to get it working by defining the following in the child theme’s functions.php:
function get_extra_menu_items() { $html = ... return $html; } if(!function_exists('avia_social_media_icons')) { function avia_social_media_icons($args = array(), $echo = true) { $icons = new avia_social_media_icons($args); $extrahtml = get_extra_menu_items(); if($echo) { echo $icons->html() . $extrahtml; } else { return $icons->html() . $extrahtml; } } }
It would be nice to see enfold gain a hook for this functionality, along with the ability for dynamic vertical sizing in an arbitrary DIV or SPAN rather than forcing the user to use an A tag where it doesn’t really belong.
If you can suggest another or better way of doing what I’ve done, I’d love to hear it!
Thanks,
JonathanApril 19, 2014 at 5:18 am #253422Hey!
Thank you for the update.
Strange because the code suggested above works on our end. Did you assign a top menu on your installation? I mean the additional menu on top of the main menu. If you don’t mind, please post the link of the test site here. We would like to inspect it.
Regards,
IsmaelApril 19, 2014 at 5:26 am #253424I did not use a top menu at all for my installation, which is why none of the code you suggested was applicable and why some of it didn’t execute. The link to my test site will follow in a private reply below.
April 19, 2014 at 5:26 am #253425This reply has been marked as private. -
AuthorPosts
- The topic ‘Adding a form and text to the right of social icons’ is closed to new replies.