Advertisement
tribulant

Custom Shortcode

Feb 20th, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. /* Create a 'gender' shortcode */
  4. // Use this in the newsletter: [gender][wpmlfield name="gender"][/gender]
  5. // Add this code to your functions.php file of your theme.
  6.  
  7.  
  8. function sc_gender($atts = null, $content = null) {
  9.  
  10.     $output = "";
  11.  
  12.     if (!empty($content)) {
  13.         switch ($content) {
  14.             case 'Herr'     :
  15.                 $output = "Geehrter";
  16.                 break;
  17.             case 'Frau'     :
  18.                 $output = "Geehrte";
  19.                 break;
  20.         }
  21.     }
  22.  
  23.     return $output;
  24. }
  25.  
  26. add_shortcode('gender', 'sc_gender');
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement