我只想在我的 WordPress 主题菜单栏中添加一个短代码按钮来处理bootstrap modal view
功能。
我试过 'Shortcodes in Menus
' 插件,但它不起作用。我在菜单中找不到短代码的替代插件,所以我安装了'Bootstrap 3 Shortcodes
'插件,它根据我的需要创建了按钮和模式视图内容。但我无法将简码添加到我的菜单栏。
我努力寻找有关我的问题的答案。但不幸的是不能。
这是我生成的模态短代码Bootstrap 3 简码 plugin;
[modal text="Download Now" title="Veteriner Hekimlere Ulaşmanın En Kolay Yolu" xclass="btn btn-primary btn-lg"]
<p style="text-align: center;"><img src="http://web-test.vetmapp.com/wp-content/uploads/sites/2/2016/08/vetmapp-logo-withtext.png" alt="Logo" width="200" height="300" /></p>
<h4 style="text-align: center;">VetMapp'i cihazınıza göre aşağıdaki platformlardan cep telefonunuza ücretsiz olarak indirebilir ve hemen kullanmaya başlayabilirsiniz.</h4>
<p style="text-align: center;">
<a href="https://itunes.apple.com/tr/app/vetmapp-acil-veteriner-klinikleri/id969463902?mt=8" target="_blank"><img src="http://web-test.vetmapp.com/wp-content/uploads/sites/2/2016/09/180x40xapple-store.png.pagespeed.ic.z0I7tHw8h6.png" alt="App Store'dan indir!" width="135" height="40" /></a>
<a href="https://play.google.com/store/apps/details?id=com.esmobileinc.vetmapp&hl=tr"
target="_blank"><img src="http://web-test.vetmapp.com/wp-content/uploads/sites/2/2016/09/180x40xgoogle_play.png.pagespeed.ic.31v8JAmtbI.png" alt="Google Play'den indir!" width="135" height="40" /></a>
<a href="https://www.microsoft.com/tr-tr/store/p/vetmapp/9nblggh4s3qm"
target="_blank"><img src="http://web-test.vetmapp.com/wp-content/uploads/sites/2/2016/09/180x40xwindows_phone.png.pagespeed.ic.xvoiaCiuDP.png" alt="Windows Store'dan indir!" width="135" height="40" /></a>
</p>
[modal-footer] [button type="primary" style="border: solid 1px #18bda3; background-color: #fff; color: #18bda3;" link="#" data="dismiss,modal"]Kapat[/button] [/modal-footer] [/modal]
我只想用[modal text="Download Now" title="Veteriner Hekimlere Ulaşmanın En Kolay Yolu" xclass="btn btn-primary btn-lg"]
into WP 导航栏。
我怎样才能做到这一点 ?我可以为此在functions.php中编写一个函数,或者尝试其他方法?
谢谢...
如果您共享您的短代码生成标记或您想要用您的短代码包装什么标记,那么最好让其他人清楚地理解。
无论如何尝试一下它会顺利工作(已测试)
add_filter( 'wp_nav_menu_items', 'wpse3967385_custom_menu_link', 10, 2 );
function wpse3967385_custom_menu_link( $items, $args ) {
if ($args->theme_location == 'primary_nav') {
$items .= '<li class="your-custom-item">' . do_shortcode( '[modal text="Download Now" title="Veteriner Hekimlere Ulaşmanın En Kolay Yolu" xclass="btn btn-primary btn-lg"]' ) . '</li>';
}
return $items;
}
请随意更改您的菜单主题位置。
希望它有意义。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)