How to define and use helper functions in theme functions.php?

Viewed 3545

How to get following to work properly in Wordress Theme functions.php file?

I haven't figured out how to make the top function available to the bottom function within the theme's functions.php file. I'm not grasping how to setup hooks so they can work together. Thank you.

Filter/helper/whateveryoucallit function:

function poohToPee( $pooh_log )
{
  switch( $pooh_log )
  {
    case 'gross-poop':
      $pee_equivalent = 'Grossest of Pees';
    break;
    case 'ok-poop':
      $pee_equivalent = 'Bland Snack Pee';
    break;
    case 'shang-tsung-plop':
      $pee-equivalent = 'Random U-Stream';
    break;
  }
  return $pee_equivalent;
}

Ajax handler function:

function screw_loose()
{
  if( isset($_REQUEST['pooh_log']) )
  {
    echo poohToPee( $_REQUEST['pooh_log'] );
  }
}
add_action('wp_ajax_priv_screw_loose', 'screw_loose')
1 Answers
Related