Advertisement
DeepTitanic

Canvas Tabs

Mar 30th, 2012
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.70 KB | None | 0 0
  1. //The first bit goes in your functions  - I've only included 2 of 9 tabs to keep it short.
  2.  
  3. Good Luck!
  4.  
  5.  
  6.  
  7. <?php
  8. /*-----------------------------------------------------------------------------------*/
  9. /* Add holes custom fields */
  10. /*-----------------------------------------------------------------------------------*/
  11. // Add more custom field
  12. function woo_metaboxes_add($woo_metaboxes) {
  13.  // Check for post type = post
  14.     if ( get_post_type() == "page" || !get_post_type() ) {
  15.  
  16.  //hole 1
  17.      $woo_metaboxes[] = array (  "name" => "holeimg1",
  18.                                     "label" => "Hole 1 Image",
  19.                                     "type" => "upload",
  20.                                     "desc" => "Click here to upload your image of this hole");
  21.  
  22.      $woo_metaboxes[] = array (  "name" => "holetitle1",
  23.                                     "label" => "Hole 1 Title Text",
  24.                                     "type" => "text",
  25.                                     "desc" => "Enter your title for this hole here");
  26.  
  27.  
  28.          $woo_metaboxes[] = array (  "name" => "holeinfo1",
  29.                                     "label" => "Hole 1 Text",
  30.                                     "type" => "textarea",
  31.                                     "desc" => "Enter your description of the golf course hole here");
  32.  
  33.      $woo_metaboxes[] = array (  "name" => "holemap1",
  34.                                     "label" => "Hole 1 Map Upload",
  35.                                     "type" => "upload",
  36.                                     "desc" => "Click in this area to upload your map of the hole");
  37. //hole 2                   
  38.                    
  39.                    
  40.      $woo_metaboxes[] = array (  "name" => "holeimg2",
  41.                                     "label" => "Hole 2 Image",
  42.                                     "type" => "upload",
  43.                                     "desc" => "Click here to upload your image of this hole");
  44.  
  45.      $woo_metaboxes[] = array (  "name" => "holetitle2",
  46.                                     "label" => "Hole 2 Title Text",
  47.                                     "type" => "text",
  48.                                     "desc" => "Enter your title for this hole here");
  49.  
  50.  
  51.          $woo_metaboxes[] = array (  "name" => "holeinfo2",
  52.                                     "label" => "Hole 2 Text",
  53.                                     "type" => "textarea",
  54.                                     "desc" => "Enter your description of the golf course hole here");
  55.  
  56.      $woo_metaboxes[] = array (  "name" => "holemap2",
  57.                                     "label" => "Hole 2 Map Upload",
  58.                                     "type" => "upload",
  59.                                     "desc" => "Click in this area to upload your map of the hole");
  60.       }  
  61.  
  62.     return $woo_metaboxes;
  63.  }?>
  64.  
  65.  
  66.  
  67.  
  68. //And this bit goes in your template.
  69.  
  70. <?php
  71.  
  72. $hole1 = '<img class="hole-image-top" src="'.get_post_meta( $post->ID, 'holeimg1', true ).'"/>'.
  73.      '<h2>' .get_post_meta( $post->ID, 'holetitle1', true ).'</h2>'.
  74.      '<span class="hole-entry">'.get_post_meta( $post->ID, 'holeinfo1', true ).
  75.      '</span>'. '<img class="hole-map-bottom" src="'. get_post_meta( $post->ID, 'holemap1', true ).'"/>';
  76.  
  77.  
  78. $hole2 = '<img class="hole-image-top" src="'.get_post_meta( $post->ID, 'holeimg2', true ).'"/>'.
  79.      '<h2>' .get_post_meta( $post->ID, 'holetitle2', true ).'</h2>'.
  80.      '<span class="hole-entry">'.get_post_meta( $post->ID, 'holeinfo2', true ).
  81.      '</span>'. '<img class="hole-map-bottom" src="'. get_post_meta( $post->ID, 'holemap2', true ).'"/>';
  82.  
  83.  
  84.     $content = '[tabs style="boxed" css="hole-by-hole"]
  85.             [tab title="Hole 1"]' .$hole1. '[/tab]
  86.             [tab title="Hole 2"]' .$hole2. '[/tab]
  87.             [/tabs]';
  88.    
  89.     echo do_shortcode( $content );
  90. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement