Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The first bit goes in your functions - I've only included 2 of 9 tabs to keep it short.
- Good Luck!
- <?php
- /*-----------------------------------------------------------------------------------*/
- /* Add holes custom fields */
- /*-----------------------------------------------------------------------------------*/
- // Add more custom field
- function woo_metaboxes_add($woo_metaboxes) {
- // Check for post type = post
- if ( get_post_type() == "page" || !get_post_type() ) {
- //hole 1
- $woo_metaboxes[] = array ( "name" => "holeimg1",
- "label" => "Hole 1 Image",
- "type" => "upload",
- "desc" => "Click here to upload your image of this hole");
- $woo_metaboxes[] = array ( "name" => "holetitle1",
- "label" => "Hole 1 Title Text",
- "type" => "text",
- "desc" => "Enter your title for this hole here");
- $woo_metaboxes[] = array ( "name" => "holeinfo1",
- "label" => "Hole 1 Text",
- "type" => "textarea",
- "desc" => "Enter your description of the golf course hole here");
- $woo_metaboxes[] = array ( "name" => "holemap1",
- "label" => "Hole 1 Map Upload",
- "type" => "upload",
- "desc" => "Click in this area to upload your map of the hole");
- //hole 2
- $woo_metaboxes[] = array ( "name" => "holeimg2",
- "label" => "Hole 2 Image",
- "type" => "upload",
- "desc" => "Click here to upload your image of this hole");
- $woo_metaboxes[] = array ( "name" => "holetitle2",
- "label" => "Hole 2 Title Text",
- "type" => "text",
- "desc" => "Enter your title for this hole here");
- $woo_metaboxes[] = array ( "name" => "holeinfo2",
- "label" => "Hole 2 Text",
- "type" => "textarea",
- "desc" => "Enter your description of the golf course hole here");
- $woo_metaboxes[] = array ( "name" => "holemap2",
- "label" => "Hole 2 Map Upload",
- "type" => "upload",
- "desc" => "Click in this area to upload your map of the hole");
- }
- return $woo_metaboxes;
- }?>
- //And this bit goes in your template.
- <?php
- $hole1 = '<img class="hole-image-top" src="'.get_post_meta( $post->ID, 'holeimg1', true ).'"/>'.
- '<h2>' .get_post_meta( $post->ID, 'holetitle1', true ).'</h2>'.
- '<span class="hole-entry">'.get_post_meta( $post->ID, 'holeinfo1', true ).
- '</span>'. '<img class="hole-map-bottom" src="'. get_post_meta( $post->ID, 'holemap1', true ).'"/>';
- $hole2 = '<img class="hole-image-top" src="'.get_post_meta( $post->ID, 'holeimg2', true ).'"/>'.
- '<h2>' .get_post_meta( $post->ID, 'holetitle2', true ).'</h2>'.
- '<span class="hole-entry">'.get_post_meta( $post->ID, 'holeinfo2', true ).
- '</span>'. '<img class="hole-map-bottom" src="'. get_post_meta( $post->ID, 'holemap2', true ).'"/>';
- $content = '[tabs style="boxed" css="hole-by-hole"]
- [tab title="Hole 1"]' .$hole1. '[/tab]
- [tab title="Hole 2"]' .$hole2. '[/tab]
- [/tabs]';
- echo do_shortcode( $content );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement