Title: Injecting a javascript banner code right before &amp; after wordpress navigation men
Last modified: August 21, 2016

---

# Injecting a javascript banner code right before & after wordpress navigation men

 *  [z0haib](https://wordpress.org/support/users/z0haib/)
 * (@z0haib)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/injecting-a-javascript-banner-code-right-before-after-wordpress-navigation-men/)
 * I am trying to develop a plugin to inject a javascript banner code right before
   and after the wordpress navigation menu but I am unable to find any solution 
   to this problem. Does anyone have any idea?
 * I cannot append to a Div ID either since every wordpress theme uses different
   div id and class for navigation menu.
 * Thanks

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/injecting-a-javascript-banner-code-right-before-after-wordpress-navigation-men/#post-4867728)
 * It’s difficult to inject content from a plugin precisely because themes use different
   ways to display content, not just IDs and classes. For any theme that uses `wp_nav_menu()`
   to display navigation, use the ‘wp_nav_menu’ filter to place your own empty divs
   before and after the nav HTML. You can then use javascript to fill the divs with
   whatever. I would hope nearly all themes use this function, but there are no 
   doubt a few mavericks that do not. Unless you want to develop custom code for
   each of these, they are pretty much a lost cause.

Viewing 1 replies (of 1 total)

The topic ‘Injecting a javascript banner code right before & after wordpress navigation
men’ is closed to new replies.

## Tags

 * [hook](https://wordpress.org/support/topic-tag/hook/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/injecting-a-javascript-banner-code-right-before-after-wordpress-navigation-men/#post-4867728)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
