Title: Add custom code to wordpress loop?
Last modified: August 21, 2016

---

# Add custom code to wordpress loop?

 *  Resolved [idealmin](https://wordpress.org/support/users/idealmin/)
 * (@idealmin)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/add-custom-code-to-wordpress-loop/)
 * Hi there. I’m wanting to use this theme with MyArcadePlugin. But I need to enter
   some code into single.php within the WordPress loop.
 * Usually this might be quite simple but your themes single.php uses a lot of custom
   codexes or something?
 * Anyway I need to enter this code into single.php
 * <?php
    if (function_exists(‘get_game’)) { /* mypostid global is needed for MyScoresPresenter*/
   global $mypostid; $mypostid = $post->ID; echo myarcade_get_leaderboard_code();
   echo get_game($post->ID); } ?>
 * As explained here [http://myarcadeplugin.com/documentation/developer-guide/#get_game](http://myarcadeplugin.com/documentation/developer-guide/#get_game)
 * But having some issue locating the right bit to edit/change.
 * Could you kindly assist me in this matter?
 * I hope.
 * Regards.
 * Mike.

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

 *  Theme Author [nobita](https://wordpress.org/support/users/nobita/)
 * (@nobita)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/add-custom-code-to-wordpress-loop/#post-4369145)
 * Hi idealmin
 * Without customizing the template, in a specific location, Raindrops theme, you
   can insert a template part file and code
 * For example
 * Add to code with action hook.
 *     ```
       add_action( 'raindrops_append_entry_content', 'your_function' );
   
       function your_function(){
       	global $post;
   
       	if ( is_single() && function_exists( 'get_game' ) ) {
   
       		/* mypostid global is needed for MyScoresPresenter */
   
       		global $mypostid; $mypostid = $post->ID;
       		echo myarcade_get_leaderboard_code();
       		echo get_game($post->ID);
       	}
       }
       ```
   
 * Using Template part file.
 * Create a template name hook-append-entry-content.php
 *     ```
       global $post;
   
       	if ( is_single() && function_exists( 'get_game' ) ) {
   
       		/* mypostid global is needed for MyScoresPresenter */
   
       		global $mypostid; $mypostid = $post->ID;
       		echo myarcade_get_leaderboard_code();
       		echo get_game($post->ID);
       	}
       ```
   
 * **How to find action hooks and template name.**
 * 1. Open wp-config.php and WP_DEBUG value set true.
 * 2. Open raindrops/functions.php or childthemes/functions.php
    when parent theme
   functions.php first line `<?php` before.
 *     ```
       <?php
         $raindrops_actions_hook_message = true;
       ?>
       ```
   
 * 3. Open your blog and shows single.php
 * When you are finished, please undo the changes always
 * Thank you.
 *  Theme Author [nobita](https://wordpress.org/support/users/nobita/)
 * (@nobita)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/add-custom-code-to-wordpress-loop/#post-4369246)
 * Since there is no reply 2 weeks, change to Resolved

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

The topic ‘Add custom code to wordpress loop?’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/raindrops/1.700/screenshot.png)
 * raindrops
 * [Support Threads](https://wordpress.org/support/theme/raindrops/)
 * [Active Topics](https://wordpress.org/support/theme/raindrops/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/raindrops/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/raindrops/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [nobita](https://wordpress.org/support/users/nobita/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/add-custom-code-to-wordpress-loop/#post-4369246)
 * Status: resolved