How to Create Custom Plugin to Add Dynamic Navigation Menu in Wordpress -
i try integrate php dynamic code directly not working properly...please solve problem how create plugin........ want create plugin using core php..................
<?php /* plugin name: # plugin uri: # description: # version: 1.0 author: # author uri: # */ ?> <?php $dbcon = new mysqli("localhost","root","","wp2"); ?> <!doctype html> <html> <head> <title>dynamic dropdown menu using php , mysqli</title> <script type="text/javascript" src="jquery.js"></script> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="head"> <div class="wrap"><br /> <label><a href="add_menu.php">add menu here</a></label> </div> </div> <div class="wrap"> <ul id="nav"> <li><a href="infoseek.php">homepage</a></li> <?php $res=$dbcon->query("select * main_menu"); while($row=$res->fetch_array()) { ?> <li><a href="<?php echo $row['m_menu_link']; ?>"><?php echo $row['m_menu_name']; ?></a> <?php $res_pro=$dbcon->query("select * sub_menu m_menu_id=".$row['m_menu_id']); ?> <ul> <?php while($pro_row=$res_pro->fetch_array()) { ?><li><a href="<?php echo $pro_row['s_menu_link']; ?>"><?php echo $pro_row['s_menu_name']; ?></a></li><?php } ?> </ul> </li> <?php } ?> </ul> </div> <script type="text/javascript"> $(document).ready(function() { $('#nav li').hover(function() { $('ul', this).slidedown('fast'); }, function() { $('ul', this).slideup('fast'); }); }); </script> </body> </html>
then new page. code here.....
<!doctype html> <html> <head> <title>dynamic dropdown menu using php , mysqli</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <center> <pre> <form method="post"> <input type="text" placeholder="menu name :" name="menu name" /><br /> <input type="text" placeholder="menu link :" name="mn_link" /><br /> <button type="submit" name="add_main_menu">add main menu</button> </form> </pre> <br /> <pre> <form method="post"> <select name="parent"> <option selected="selected">select parent menu</option> <?php $res=$dbcon->query("select * main_menu"); while($row=$res->fetch_array()) { ?> <option value="<?php echo $row['m_menu_id']; ?>"><?php echo $row['m_menu_name']; ?></option> <?php } ?> </select><br /> <input type="text" placeholder="menu name :" name="sub_menu_name" /><br /> <input type="text" placeholder="menu link :" name="sub_menu_link" /><br /> <button type="submit" name="add_sub_menu">add sub menu</button> </form> </pre> <a href="infoseek.php">back main page</a> </center> </body> </html>
Comments
Post a Comment