admin管理员组文章数量:1130349
I'm making my first site with WP, I'm a Joomla Developper. I'm using wisten theme, and WP 3.9.2
I want to create a link in my the navigation that opens a modal window (not a new page) on click. Example - , when you click the LOGIN link I have no clue of how I should do this in WordPress.
The Jquery code for such an operation is not very difficult, the code is here :
/
but I have no clue of how to integrate it.
Any help would be appreciated
I'm making my first site with WP, I'm a Joomla Developper. I'm using wisten theme, and WP 3.9.2
I want to create a link in my the navigation that opens a modal window (not a new page) on click. Example - http://kendo.mx , when you click the LOGIN link I have no clue of how I should do this in WordPress.
The Jquery code for such an operation is not very difficult, the code is here :
http://jsfiddle/mmetsalu/hBX6E/2/
but I have no clue of how to integrate it.
Any help would be appreciated
Share Improve this question edited Aug 18, 2014 at 23:53 Ray Mitchell 91911 silver badges29 bronze badges asked Aug 18, 2014 at 21:30 Juliatzin del ToroJuliatzin del Toro 1471 silver badge7 bronze badges1 Answer
Reset to default 1Using bootstrap's modal you could use this hook in your function.php file top do that:
add_filter( 'nav_menu_link_attributes', 'menu_atts', 10, 3 );
function menu_atts( $atts, $item, $args )
{
// The ID of the target menu item
$menu_target = 24;
// inspect $item
if ($item->ID == $menu_target) {
$atts['data-toggle'] = 'modal';
$atts['data-target'] = '#IDofModal';
}
return $atts;
}
I'm making my first site with WP, I'm a Joomla Developper. I'm using wisten theme, and WP 3.9.2
I want to create a link in my the navigation that opens a modal window (not a new page) on click. Example - , when you click the LOGIN link I have no clue of how I should do this in WordPress.
The Jquery code for such an operation is not very difficult, the code is here :
/
but I have no clue of how to integrate it.
Any help would be appreciated
I'm making my first site with WP, I'm a Joomla Developper. I'm using wisten theme, and WP 3.9.2
I want to create a link in my the navigation that opens a modal window (not a new page) on click. Example - http://kendo.mx , when you click the LOGIN link I have no clue of how I should do this in WordPress.
The Jquery code for such an operation is not very difficult, the code is here :
http://jsfiddle/mmetsalu/hBX6E/2/
but I have no clue of how to integrate it.
Any help would be appreciated
Share Improve this question edited Aug 18, 2014 at 23:53 Ray Mitchell 91911 silver badges29 bronze badges asked Aug 18, 2014 at 21:30 Juliatzin del ToroJuliatzin del Toro 1471 silver badge7 bronze badges1 Answer
Reset to default 1Using bootstrap's modal you could use this hook in your function.php file top do that:
add_filter( 'nav_menu_link_attributes', 'menu_atts', 10, 3 );
function menu_atts( $atts, $item, $args )
{
// The ID of the target menu item
$menu_target = 24;
// inspect $item
if ($item->ID == $menu_target) {
$atts['data-toggle'] = 'modal';
$atts['data-target'] = '#IDofModal';
}
return $atts;
}
本文标签: How to open modal window when clicking a WP menu link
版权声明:本文标题:How to open modal window when clicking a WP menu link? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749239039a2337768.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论