Site logo

Archived topic

Javascript in slideout navigation hook

5 replies · Started by Jamal on October 6, 2016

Viewing posts 1–6 of 6

Hi

Is it possible to run javascript in the generate_inside_slideout_navigation hook? I tried running a script there but i cant make it work for some reason.

You can run javascript anywhere and it will apply to any element throughout the page - it doesn't need to be placed anywhere specifically for it to work.

The best place for javascript is the wp_footer hook.

Let me know if you need more info :)

I have finally learnt how to enque my scripts, so i did enque the script but i will like to dislay a HTML table inside the slideout navigation. Basically run this code inside the slideout navigation hook

Should be pretty easy, you just need to use the generate_inside_slideout_navigation hook.

add_action( 'generate_inside_slideout_navigation','jamal_add_slideout_html' );
function jamal_add_slideout_html()
{
?>
    Your stuff in here
<?php
}

That worked, thanks :)

I have the slideout navigation set to both, please help me with the following:

1. On desktop hide some/all menu items in the slideout.
2. On mobile, move menu items above the inside_slideout_navigation hook.

1. You could give those menu item custom classes.

hide-on-desktop
hide-on-tablet
hide-on-mobile

2. That's not possible but there is a generate_after_slideout_navigation hook you can take advantage of.

This archived topic is closed to new replies.