Title: Custom link menu including javascript AND if session
Last modified: August 30, 2016

---

# Custom link menu including javascript AND if session

 *  [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/custom-link-menu-including-javascript-and-if-session/)
 * Hello,
    I need help please. I have menu links such as this one which I need to
   implement in my wordpress menu and don’t know how to :
 *     ```
       <a href="void(0)">';document.forms['rencMenu'].submit();"><li <?php if (strstr($_SESSION['rencontre'],'portrait') && $_GET["id"]==$mid) echo 'class="current"'; ?>>
       ```
   
 * Thank you for your help !
    Lucile
 * [Moderator note: code fixed. Please wrap code in the backtick character or [use the code button](https://codex.wordpress.org/Forum_Welcome#Posting_Code).]

Viewing 1 replies (of 1 total)

 *  Thread Starter [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/custom-link-menu-including-javascript-and-if-session/#post-6368987)
 * Oops the code didn’t come out properly.
 * Here is the kind of menu links I need to implement in my wordpress menu :
 * `<a href="javascript:void(0)" onClick="document.forms['rencMenu'].elements['page'].
   value='portrait';document.forms['rencMenu'].elements['id'].value='<?php echo 
   $mid; ?>';document.forms['rencMenu'].submit();"><li <?php if (strstr($_SESSION['
   rencontre'],'portrait') && $_GET["id"]==$mid) echo 'class="current"'; ?>>Title
   </li></a>`
 * I figured out that using # in wordpress menu via the admin works for the javascript
   part entering the function in the functions.php file but how do I do for the “
   if session” part ?
 * Thank you,
 * Lucile

Viewing 1 replies (of 1 total)

The topic ‘Custom link menu including javascript AND if session’ is closed to new
replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [lucilem](https://wordpress.org/support/users/lucilem/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/custom-link-menu-including-javascript-and-if-session/#post-6368987)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
