Title: Banshee01's Replies | WordPress.org

---

# Banshee01

  [  ](https://wordpress.org/support/users/banshee01/)

 *   [Profile](https://wordpress.org/support/users/banshee01/)
 *   [Topics Started](https://wordpress.org/support/users/banshee01/topics/)
 *   [Replies Created](https://wordpress.org/support/users/banshee01/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/banshee01/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/banshee01/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/banshee01/engagements/)
 *   [Favorites](https://wordpress.org/support/users/banshee01/favorites/)

 Search replies:

## Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Convert My Code's In To Metabox](https://wordpress.org/support/topic/convert-my-codes-in-to-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/convert-my-codes-in-to-metabox/#post-6333282)
 * Please Anwser me 🙁
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Convert My Code's In To Metabox](https://wordpress.org/support/topic/convert-my-codes-in-to-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/convert-my-codes-in-to-metabox/#post-6333267)
 * Any Solution? Please
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Convert My Code's In To Metabox](https://wordpress.org/support/topic/convert-my-codes-in-to-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/convert-my-codes-in-to-metabox/#post-6333256)
 * UP
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [how can add jquery code in metabox?](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years ago](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/#post-6008982)
 * hi there
    here is my js and php codes java:
 *     ```
       <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
   
               <script>
               $('form').submit(function (e) { 
   
                   e.preventDefault(); 
   
                   var gnameInput = this.children["gname"].value; // the "gname" input 
   
                   var postVariables = {
                       gname: gnameInput
                   }; 
   
                   var postUrl = this.action; // the "action" attribute of your form. 
   
                   $.post(postUrl, postVariables, function (result) { 
   
                       $("#MyResultsDiv").html(result); 
   
                   }).fail(function (result) {
                       console.log("Wean Error!");
                   });
               });
               </script>
       ```
   
 * and PHP:
 *     ```
       <?php
       // define variables and set to empty values
       $gname =  "";
       if ($_SERVER["REQUEST_METHOD"] == "POST") {
          $gname = test_input($_POST["gname"]);
       }
       function test_input($data) {
          $data = trim($data);
          $data = stripslashes($data);
          $data = htmlspecialchars($data);
          return $data;
       }
       $urls= ("http://thegamesdb.net/api/GetGamesList.php?name=".$gname."");
       $search = new SimpleXMLElement(file_get_contents($urls));
   
       // HERE IS WHERE YOUR RESULTS ARE OUTPUT
       // THIS GETS SENT TO THE JavaScript CODE
   
       foreach($search as $object){
       echo "<li>".$object->GameTitle."     ";
       echo "     ID:".$object->id."</li>";
       }
       ?>
       ```
   
 * my js and php is working fine i just dont know how to use it in function.php
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [how can add jquery code in metabox?](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years ago](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/#post-6008973)
 * my code :
 *     ```
       function my_template_jquery() {
       wp_enqueue_script( '/js/games.js' );
       }
       add_action( 'wp_enqueue_scripts', 'my_template_jquery' );
   
       //////////////////////////////////////////////////////////////////
       // Register games Metabox
       //////////////////////////////////////////////////////////////////
       $prefixg = 'games_';
   
       $game_box = array(
           'id' => 'game-meta-box',
           'title' => 'gamesprofile',
           'page' => 'post',
           'context' => 'normal',
           'priority' => 'high',
           'fields' => array(
       		   array(
                   'name' => 'GameName',
                   'desc' => 'add game name here',
                   'id' => $prefixg  . 'gname',
                   'type' => 'form',
                   'std' => ''
               ),
       				   array(
                   'name' => 'game lists',
                   'desc' => '',
                   'id' => $prefixg  . 'glist',
                   'type' => 'echogame',
                   'std' => ''
               ),
       		    array(
                   'name' => 'add your game ID here',
                   'desc' => 'add gameID',
                   'id' => $prefixg  . 'gameid',
                   'type' => 'text',
                   'std' => ''
               ),
       		 array(
                   'name' => 'platforms',
                   'desc' => 'chose your platforms',
                   'id' => $prefixg  . 'platforms',
                   'type' => 'text',
                   'std' => ''
               )
           )
       );
   
       add_action('admin_menu', 'game_add_box');
       // Add meta box
       function game_add_box() {
           global $game_box;
          add_meta_box($game_box['id'], $game_box['title'], 'game_show_box', $game_box['page'], $game_box['context'], $game_box['priority']);
       }
       // Callback function to show fields in meta box
       function game_show_box() {
           global $game_box, $post;
           // Use nonce for verification
           echo '<input type="hidden" name="game_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
           echo '<table class="form-table">';
           foreach ($game_box['fields'] as $field) {
               // get current post meta data
               $gmeta = get_post_meta($post->ID, $field['id'], true);
               echo '<tr>',
                       '<th style="width:20%"><label for="', $field['id'], '">', $field['name'], '</label></th>',
                       '<td>';
               switch ($field['type']) {
                   case 'text':
                       echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $gmeta ? $gmeta : $field['std'], '" size="30" style="width:97%" />', '<br />', $field['desc'];
                       break;
                   case 'form':
       			// define variables and set to empty values
                       echo '<form method="post" autocomplete="on" action="("admin/process_form.php");">
       				<input type="text" name="gname" >
       				<input type="submit"name="submit" value="search">', $gmeta ? $gmeta : $field['std'], '</form>', '<br />', $field['desc'];
                       break;
   
       			case 'echogame':
       	        echo '<div id="MyResultsDiv"> ', $gmeta ? $gmeta : $field['std'], '</div>', '<br />', $field['desc'];
       		    break;
               }
               echo     '</td><td>',
                   '</td></tr>';
           }
           echo '</table>';
       }
       ```
   
 * all work fines i just want know where is my problem to resulte game names under
   the search game i just need call my JS for show results
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [how can add jquery code in metabox?](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years ago](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/#post-6008964)
 * see i want show result serch with java script under search bar so how can i made
   it? its possibel?
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [how can add jquery code in metabox?](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/#post-6008930)
 * like this?
 *     ```
       echo '<form method="post" autocomplete="on" action="("admin/process_form.php");">
       				<input type="text" name="gname" >
       				<input type="submit"name="submit" value="search">', $gmeta ? $gmeta : $field['std'], '</form>', '<br />', $field['desc'];
                       break;
   
       			case 'echogame':
       	        echo '<div id="MyResultsDiv"> ', $gmeta ? $gmeta : $field['std'], '</div>', '<br />', $field['desc'];
       		    break;
       ```
   
 * and js:
 *     ```
       function my_template_jquery() {
       wp_enqueue_script( '/js/games.js' );
       }
       add_action( 'wp_enqueue_scripts', 'my_template_jquery' );
       ```
   
 * so i made like this but not work can you just see my code and help me to find
   problems
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [how can add jquery code in metabox?](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/how-can-add-jquery-code-in-metabox/#post-6008860)
 * i know can you help me for js? how can i use js in function?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to create Search form in php based on xml link](https://wordpress.org/support/topic/how-to-create-search-form-in-php-based-on-xml-link/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/how-to-create-search-form-in-php-based-on-xml-link/#post-5985030)
 * so much thanks for not helping…
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to call a category slug or ID category](https://wordpress.org/support/topic/how-to-call-a-category-slug-or-id-category/)
 *  Thread Starter [Banshee01](https://wordpress.org/support/users/banshee01/)
 * (@banshee01)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/how-to-call-a-category-slug-or-id-category/#post-5436305)
 * Tim Nash ty for anwser but its not work 🙁

Viewing 10 replies - 1 through 10 (of 10 total)