Title: using functions.php (theme functions)
Last modified: August 19, 2016

---

# using functions.php (theme functions)

 *  [richoid](https://wordpress.org/support/users/richoid/)
 * (@richoid)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/using-functionsphp-theme-functions/)
 * I put this in functions.php:
 *     ```
       function superslide_load() {
       		$tdir = 'superheader';
       		$dh  = opendir($tdir);
       		while (false !== ($filename = readdir($dh))) {
       		    $files[] = $filename;
       		}
   
       	        //$dirs = scandir($tdir);
       	        foreach($files as $file) {
       	                if (($file == '.')||($file == '..'))
       	                {
       	                }
       	                elseif (is_dir($tdir.'/'.$file))
       	                {
       	                        filesInDir($tdir.'/'.$file);
       	                }
       	                else
       	                {
       	                      echo  '<div><img src="'. $tdir.'/'.$file.'"/></div>';
       	                }
       	        }
       	}
       ```
   
 * I tried calling it (within php tags, in the body of the page.php template) with:
 * superslide_load() and also tried:
    `<?php if ( function_exists( 'superslide_load'))
   superslide_load(); ?>`
 * then I added:
    `add_action('wp_head', 'superslide_load');` to the functions.php(
   right after the function closed) and tried calling it this way: `<?php do_action('
   superslide_load', '' ); ?>`
 * No luck! No errors! Just nothing. Weird because I had this working in MAMP locally(
   the first sample, above), but can’t make it work on the public server.
 * Any clues? Thanks!

Viewing 1 replies (of 1 total)

 *  Thread Starter [richoid](https://wordpress.org/support/users/richoid/)
 * (@richoid)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/using-functionsphp-theme-functions/#post-1415134)
 * Another note: I first tried:
 *     ```
       function superslide_load()
       	{	$tdir = 'superheader';
       	        $dirs = scandir($tdir);
       	        foreach($dirs as $file)
       	        {
       	                if (($file == '.')||($file == '..'))
       	                {
       	                }
       	                elseif (is_dir($tdir.'/'.$file))
       	                {
       	                        filesInDir($tdir.'/'.$file);
       	                }
       	                else
       	                {
       	                      echo  '<li><img src="'. $tdir.'/'.$file.'"/></li>';
       	                }
       	        }
       	}
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘using functions.php (theme functions)’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [richoid](https://wordpress.org/support/users/richoid/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/using-functionsphp-theme-functions/#post-1415134)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
