1 | | better idea! please, why dont you add this to WP-core?: |
2 | | attach each link ("<a>" tag) the id of the object. for example: |
3 | | |
4 | | |
5 | | {{{ |
6 | | <li> |
7 | | <a class="p284"> |
8 | | </li> |
9 | | }}} |
10 | | |
11 | | |
12 | | that means POST,with id 284 |
13 | | |
14 | | or |
15 | | |
16 | | {{{ |
17 | | <li> |
18 | | <a class="c284"> |
19 | | </li> |
20 | | }}} |
21 | | |
22 | | |
23 | | that means category,with id 284 |
24 | | |
25 | | and so on... It will be very good! |
26 | | for this, there exists a filter: |
27 | | |
28 | | |
29 | | {{{ |
30 | | |
31 | | function add_menu_atts( $atts, $item, $args ) { |
32 | | $atts['onClick'] = 'return true'; return $atts; |
33 | | } |
34 | | add_filter( 'nav_menu_link_attributes', 'add_menu_atts', 10, 3 ); |
35 | | }}} |
36 | | |
37 | | |
| 1 | Best solution is here - http://wordpress.stackexchange.com/a/232574/33667 |