Advertisement
jzvestor

first producy appearing twice

Jan 6th, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 26.71 KB | None | 0 0
  1. <?php
  2. /** Start the engine */
  3. require_once( get_template_directory() . '/lib/init.php' );
  4. require_once( get_stylesheet_directory() . '/lib/style.php' );
  5.  
  6. /** Child theme (do not remove) */
  7. define( 'CHILD_THEME_NAME', 'Backcountry Child Theme' );
  8. define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/backcountry' );
  9. add_theme_support('post-templates');
  10.  
  11. $content_width = apply_filters( 'content_width', 470, 400, 910 );
  12.  
  13.   ///limit excerpt
  14.  
  15. function limit_words($string, $word_limit) {
  16.  
  17.     // creates an array of words from $string (this will be our excerpt)
  18.     // explode divides the excerpt up by using a space character
  19.  
  20.     $words = explode(' ', $string);
  21.  
  22.     // this next bit chops the $words array and sticks it back together
  23.     // starting at the first word '0' and ending at the $word_limit
  24.     // the $word_limit which is passed in the function will be the number
  25.     // of words we want to use
  26.     // implode glues the chopped up array back together using a space character
  27.  
  28.     return implode(' ', array_slice($words, 0, $word_limit));
  29.  
  30. }
  31.  
  32.  
  33.  
  34. /** Add new image sizes */
  35. add_image_size( 'home-bottom', 170, 90, TRUE );
  36. add_image_size( 'home-middle', 265, 150, TRUE );
  37. add_image_size( 'home-mini', 50, 50, TRUE );
  38.  
  39. /** Add support for custom background */
  40. add_custom_background();
  41.  
  42. /** Add support for custom header */
  43. add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 120 ) );
  44.  
  45. /** Reposition the primary navigation */
  46. remove_action( 'genesis_after_header', 'genesis_do_nav' );
  47. add_action( 'genesis_before_header', 'genesis_do_nav' );
  48.  
  49. /** Add description to secondary navigation */
  50. add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 );
  51. function add_description( $item_output, $item, $depth, $args ) {
  52.  
  53.     $args = (array) $args;
  54.        
  55.     if ( $args['theme_location'] != 'primary' )  {
  56.         return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<div class=\"menu-description\">{$item->post_content}</div><", $item_output );
  57.     }
  58.     else {
  59.         return $item_output;
  60.     }
  61.  
  62. }
  63.  
  64. /** Add home top section to homepage */
  65. add_action( 'genesis_before_content_sidebar_wrap', 'backcountry_home_top' );
  66. function backcountry_home_top() {
  67.  
  68.     if ( is_front_page() && is_active_sidebar( 'home-top' ) ) {
  69.         echo '<div id="home-top">';
  70.         dynamic_sidebar( 'home-top' );
  71.         echo '</div><!-- end #home-top -->';
  72.     }
  73.  
  74. }
  75.  
  76. /** Customize the post info function */
  77. add_filter( 'genesis_post_info', 'backcountry_post_info_filter' );
  78. function backcountry_post_info_filter( $post_info ) {
  79.  
  80.     return '[post_date] by [post_author_posts_link] &middot; [post_comments] [post_edit]';
  81.  
  82. }
  83.  
  84. /** Customize the post meta function */
  85. add_filter( 'genesis_post_meta', 'backcountry_post_meta_filter' );
  86. function backcountry_post_meta_filter( $post_meta ) {
  87.    
  88.     return '[post_categories before="Filed Under: "] &middot; [post_tags before="Tagged: "]';
  89.  
  90. }
  91.  
  92. /** Add after post ad section */
  93. add_action( 'genesis_after_post_content', 'backcountry_after_post_ad', 9 );
  94. function backcountry_after_post_ad() {
  95.  
  96.     if ( is_single() && is_active_sidebar( 'after-post-ad' ) ) {
  97.         echo '<div class="after-post-ad">';
  98.         dynamic_sidebar( 'after-post-ad' );
  99.         echo '</div><!-- end .after-post-ad -->';
  100.     }
  101.  
  102. }
  103.  
  104. /** Add support for 3-column footer widgets */
  105. add_theme_support( 'genesis-footer-widgets', 4 );
  106.  
  107. /** Register widget areas */
  108. genesis_register_sidebar( array(
  109.     'id'            => 'home-top',
  110.     'name'          => __( 'Home Top', 'backcountry' ),
  111.     'description'   => __( 'This is the home top section.', 'backcountry' ),
  112. ) );
  113. genesis_register_sidebar( array(
  114.     'id'            => 'home-left',
  115.     'name'          => __( 'Home Left', 'backcountry' ),
  116.     'description'   => __( 'This is the home left section.', 'backcountry' ),
  117. ) );
  118. genesis_register_sidebar( array(
  119.     'id'            => 'home-right',
  120.     'name'          => __( 'Home Right', 'backcountry' ),
  121.     'description'   => __( 'This is the home right section.', 'backcountry' ),
  122. ) );
  123. genesis_register_sidebar( array(
  124.     'id'            => 'home-bottom',
  125.     'name'          => __( 'Home Bottom', 'backcountry' ),
  126.     'description'   => __( 'This is the home bottom section.', 'backcountry' ),
  127. ) );
  128. genesis_register_sidebar( array(
  129.     'id'            => 'after-post-ad',
  130.     'name'          => __( 'After Post Ad', 'magazine' ),
  131.     'description'   => __( 'This is the after post ad section.', 'backcountry' ),
  132. ) );
  133.  
  134. // Allows Shortcodes in text widgets
  135. add_filter('widget_text', 'do_shortcode');
  136.  
  137. // Modify credits section
  138. add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
  139. function custom_footer_creds_text($creds) {
  140.     $creds =  '[footer_copyright]' . get_bloginfo('name') . ' &bull; Site by <a href="http://www.trailsherpa.com">Trail Sherpa LLC</a> &bull; <a href="http://www.trailsherpa.com/about-us/">About Us</a> <br> <a href="http://www.trailsherpa.com/wp-login.php">Team Trail Sherpa Login</a> &bull; <a href="http://www.trailsherpa.com//website-use-and-privacy-policy/">Privacy</a>  &bull; <a href="http://www.trailsherpa.com/report-a-bug/">Report a Bug</a><br>
  141.     Trail Sherpa is a Proud Member of <br><a href="http://onepercentfortheplanet.org/" target="_blank"><img src="/wp-content/uploads/2011/09/1percent_logo.gif"></a> ';
  142.     return $creds;
  143. }
  144.  
  145. //add CPTs to author page
  146. function custom_post_author_archive($query) {
  147.     if ($query->is_author)
  148.         $query->set( 'post_type', array('trails', 'recipes', 'reviews', 'post') );
  149.     remove_action( 'pre_get_posts', 'custom_post_author_archive' );
  150. }
  151. add_action('pre_get_posts', 'custom_post_author_archive');
  152.  
  153. //altering the author box
  154. add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
  155. add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
  156.  
  157. function my_show_extra_profile_fields( $user ) { ?>
  158.  
  159.     <h3>Extra profile information</h3>
  160.  
  161.     <table class="form-table">
  162.  
  163.         <tr>
  164.             <th><label for="twitter">Twitter Username</label></th>
  165.  
  166.             <td>
  167.                 <input type="text" name="twitter" id="twitter" value="<?php echo esc_attr( get_the_author_meta( 'twitter', $user->ID ) ); ?>" class="regular-text" /><br />
  168.                 <span class="description">Please enter your Twitter username.</span>
  169.             </td>
  170.         </tr>
  171.         <tr>
  172.             <th><label for="facebook">Facebook Profile Name</label></th>
  173.  
  174.             <td>
  175.                 <input type="text" name="facebook" id="facebook" value="<?php echo esc_attr( get_the_author_meta( 'facebook', $user->ID ) ); ?>" class="regular-text" /><br />
  176.                 <span class="description">Please enter JUST your facebook profile name (i.e <b>profile_name</b>.</span>
  177.             </td>
  178.         </tr>
  179.         <tr>
  180.             <th><label for="facebook">Facebook Page Name or ID</label></th>
  181.  
  182.             <td>
  183.                 <input type="text" name="facebookpg" id="facebookpg" value="<?php echo esc_attr( get_the_author_meta( 'facebookpg', $user->ID ) ); ?>" class="regular-text" /><br />
  184.                 <span class="description">Please enter JUST your facebook fan page name/id (i.e <b>page_name</b>.</span>
  185.             </td>
  186.         </tr>
  187.          <tr>
  188.             <th><label for="google">Google+ ID</label></th>
  189.  
  190.             <td>
  191.                 <input type="text" name="google" id="google" value="<?php echo esc_attr( get_the_author_meta( 'google', $user->ID ) ); ?>" class="regular-text" /><br />
  192.                 <span class="description">Please enter JUST your Google+ ID (i.e <b>123456789</b>.</span>
  193.             </td>
  194.         </tr>
  195.         <tr>
  196.             <th><label for="flickr">Flickr Page ID</label></th>
  197.  
  198.             <td>
  199.                 <input type="text" name="flickr" id="flickr" value="<?php echo esc_attr( get_the_author_meta( 'flickr', $user->ID ) ); ?>" class="regular-text" /><br />
  200.                 <span class="description">Please enter JUST your Flickr Page ID name (i.e <b>id_name</b>.</span>
  201.             </td>
  202.         </tr>
  203.         <tr>
  204.             <th><label for="youtube">YouTube Channel Name</label></th>
  205.  
  206.             <td>
  207.                 <input type="text" name="youtube" id="youtube" value="<?php echo esc_attr( get_the_author_meta( 'youtube', $user->ID ) ); ?>" class="regular-text" /><br />
  208.                 <span class="description">Please enter JUST your YouTube Channel Name (i.e <i>channel_name</i>.</span>
  209.             </td>
  210.         </tr>
  211.        
  212.  
  213.     </table>
  214.  
  215. <?php }
  216. add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
  217. add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
  218.  
  219. function my_save_extra_profile_fields( $user_id ) {
  220.  
  221.     if ( !current_user_can( 'edit_user', $user_id ) )
  222.         return false;
  223.  
  224.     /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
  225.     update_usermeta( $user_id, 'twitter', $_POST['twitter'] );    
  226.     update_usermeta( $user_id, 'facebook', $_POST['facebook'] );
  227.     update_usermeta( $user_id, 'facebookpg', $_POST['facebookpg'] );
  228.     update_usermeta( $user_id, 'google', $_POST['google'] );
  229.     update_usermeta( $user_id, 'flickr', $_POST['flickr'] );
  230.     update_usermeta( $user_id, 'linkedin', $_POST['linkedin'] );
  231.     update_usermeta( $user_id, 'youtube', $_POST['youtube'] );
  232.     update_usermeta( $user_id, 'email', $_POST['email'] );
  233. }
  234. function my_author_box() {
  235.  
  236. ?>
  237.     <div class="author-box">
  238.         <?php echo get_avatar( get_the_author_meta( 'user_email' ), '70' ); ?>
  239.  
  240.         <strong><?php the_author_posts_link(); ?></strong>
  241.        
  242.  
  243.         <p class="author-description author-bio">
  244.             <?php the_author_meta( 'description' ); ?>
  245.         </p><div class="sm-box2"><ul>
  246.  
  247.         <?php if ( get_the_author_meta( 'twitter' ) ) { ?>
  248.             <li>
  249.                 <a href="http://twitter.com/<?php the_author_meta( 'twitter' ); ?>"target="_blank" title="Follow <?php the_author_meta( 'display_name' ); ?> on Twitter"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/08/sm_icons_02.gif"  height="35"/></a>
  250.             </li>
  251.         <?php } // End check for twitter ?>
  252.        
  253.         <?php if ( get_the_author_meta( 'facebook' ) ) { ?>
  254.             <li>
  255.                 <a href="http://www.facebook.com/<?php the_author_meta( 'facebook' ); ?>" target="_blank" title="Follow <?php the_author_meta( 'display_name' ); ?> on Facebook"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/08/sm_icons_01.gif" height="35"/></a>
  256.             </li>
  257.         <?php } // End check for fb ?>
  258.         <?php if ( get_the_author_meta( 'facebookpg' ) ) { ?>
  259.             <li>
  260.                 <a href="http://www.facebook.com/<?php the_author_meta( 'facebookpg' ); ?>" target="_blank" title="Become a Fan <?php the_author_meta( 'display_name' ); ?> on Facebook"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/09/sm_icons_10.png" height="35"/></a>
  261.             </li>
  262.         <?php } // End check for fbpg ?>
  263.         <?php if ( get_the_author_meta( 'google' ) ) { ?>
  264.             <li>
  265.                 <a href="https://plus.google.com/<?php the_author_meta( 'google' ); ?>" target="_blank" title="Follow <?php the_author_meta( 'display_name' ); ?> on Google+"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/08/sm_icons_05.png" height="35"/></a>
  266.             </li>
  267.         <?php } // End check for google ?>
  268.        
  269.          <?php if ( get_the_author_meta( 'flickr' ) ) { ?>
  270.             <li>
  271.                 <a href="http://www.flickr.com/photos/<?php the_author_meta( 'flickr' ); ?>" target="_blank" title="Find <?php the_author_meta( 'display_name' ); ?> on flickr"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/09/sm_icons_08.png" height="35"/></a>
  272.             </li>
  273.         <?php } // End check for flickr ?>
  274.        
  275.           <?php if ( get_the_author_meta( 'youtube' ) ) { ?>
  276.             <li>
  277.                 <a href="http://www.youtube.com/user/<?php the_author_meta( 'youtube' ); ?>" target="_blank" title="Find <?php the_author_meta( 'display_name' ); ?> on youtube"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/09/sm_icons_09.png" height="35"/></a>
  278.             </li>
  279.         <?php } // End check for youtube ?>
  280.        
  281.           <?php if ( get_the_author_meta( 'email' ) ) { ?>
  282.             <li><a href="mailto:<?php the_author_meta( 'email' ); ?>" title="email"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/09/sm_icons_06.png" height="35"/></a>
  283.             </li>
  284.         <?php } // End check for email ?>
  285.          <?php if ( get_the_author_meta( 'url' ) ) { ?>
  286.             <li><a href="<?php the_author_meta( 'url' ); ?>" title="website" target="_blank"><img src="http://www.trailsherpa.com/wp-content/uploads/2011/09/sm_icons_07.png" height="35"/></a>
  287.             </li>      
  288.         <?php } // End check for website ?>
  289.      
  290.        
  291.     </ul></div> </div><?php
  292. }
  293.  
  294. remove_action('genesis_after_post', 'genesis_do_author_box_single');
  295. add_action('genesis_after_post_content', 'genesis_do_MYauthor_box_single');
  296. function genesis_do_MYauthor_box_single() {
  297. if(is_single()) {        
  298. my_author_box();    
  299. }}
  300.  
  301.  
  302.  
  303.        
  304.  
  305. //Custom post types
  306.  
  307. include_once('lib/post-type/post-types.php');       // post types class
  308. include_once('lib/post-type/register-posttypes.php');   // register post types
  309.  
  310.  
  311. // Include & setup custom metabox and fields
  312. $prefix = '_cmb_'; // start with an underscore to hide fields from custom fields list
  313. $meta_boxes = array();
  314.  
  315. $meta_boxes[] = array(
  316.     'id' => 'trail_details',
  317.     'title' => 'Trail Details',
  318.     'pages' => array('trails'), // post type
  319.     'context' => 'normal',
  320.     'priority' => 'low',
  321.     'show_names' => false, // Show field names on the left
  322.     'fields' => array(
  323.         array(
  324.             'name' => 'Trail Duration',
  325.             'desc' => 'Enter Trail Duration',
  326.             'id' => $prefix . 'trail_duration',
  327.             'type' => 'text_small'
  328.         ),
  329.         array(
  330.             'name' => 'City',
  331.             'desc' => 'Enter Trail City',
  332.             'id' => $prefix . 'trail_city',
  333.             'type' => 'text_small'
  334.         ),
  335.         array(
  336.             'name' => 'Difficulty',
  337.             'desc' => 'Enter Trail Difficulty',
  338.             'id' => $prefix . 'trail_difficulty',
  339.             'type' => 'text_small'
  340.         ),
  341.         array(
  342.             'name' => 'Time on Trail',
  343.             'desc' => 'Enter Time on Trail',
  344.             'id' => $prefix . 'trail_time',
  345.             'type' => 'text_small'
  346.         ),
  347.         array(
  348.             'name' => 'Distance',
  349.             'desc' => 'Enter Trail Distance',
  350.             'id' => $prefix . 'trail_distance',
  351.             'type' => 'text_small'
  352.         ),
  353.         array(
  354.             'name' => 'Elevation',
  355.             'desc' => 'Enter Trail Elevation',
  356.             'id' => $prefix . 'trail_elevation',
  357.             'type' => 'text_small'
  358.         ),
  359.     )
  360. );
  361.  
  362. $meta_boxes[] = array(
  363.     'id' => 'trail_images',
  364.     'title' => 'Trail Images',
  365.     'pages' => array('trails'), // post type
  366.     'context' => 'normal',
  367.     'priority' => 'low',
  368.     'show_names' => false, // Show field names on the left
  369.     'fields' => array(
  370.         array(
  371.             'name' => 'Flickr Gallery',
  372.             'desc' => 'Paste code from Flickr',
  373.             'id' => $prefix . 'trail_flickr',
  374.             'type' => 'wysiwyg'
  375.         ),
  376.         array(
  377.             'name' => 'Trail Images',
  378.             'desc' => 'Upload a file or enter an URL.',
  379.             'id' => $prefix . 'trail_images',
  380.             'type' => 'multiple_files'
  381.         ),
  382.     )
  383. );
  384.  
  385. $meta_boxes[] = array(
  386.     'id' => 'trail_video',
  387.     'title' => 'Trail Video',
  388.     'pages' => array('trails'), // post type
  389.     'context' => 'normal',
  390.     'priority' => 'low',
  391.     'show_names' => false, // Show field names on the left
  392.     'fields' => array(
  393.         array(
  394.             'name' => 'Trail Video',
  395.             'desc' => 'Paste Embed Video URL from YouTube: i.e. http://www.youtube.com/embed/4T4BsjIvgvU?rel=0&amp;hd=1',
  396.             'id' => $prefix . 'trail_video',
  397.             'type' => 'text_medium'
  398.         ),
  399.         array(
  400.             'name' => 'Trail Video Description',
  401.             'desc' => 'Video Description',
  402.             'id' => $prefix . 'trail_video_description',
  403.             'type' => 'wysiwyg'
  404.         ),
  405.        
  406.     )
  407. );
  408.  
  409. $meta_boxes[] = array(
  410.     'id' => 'trail_notes',
  411.     'title' => 'Trail Notes',
  412.     'pages' => array('trails'), // post type
  413.     'context' => 'normal',
  414.     'priority' => 'low',
  415.     'show_names' => false, // Show field names on the left
  416.     'fields' => array(
  417.         array(
  418.             'name' => 'Trail Notes',
  419.             'desc' => 'Enter Trail Notes',
  420.             'id' => $prefix . 'trail_notes',
  421.             'type' => 'wysiwyg'
  422.         ),
  423.     )
  424. );
  425.  
  426. $meta_boxes[] = array(
  427.     'id' => 'special_skills',
  428.     'title' => 'Special Skills',
  429.     'pages' => array('trails'), // post type
  430.     'context' => 'normal',
  431.     'priority' => 'low',
  432.     'show_names' => false, // Show field names on the left
  433.     'fields' => array(
  434.         array(
  435.             'name' => 'Special Skills',
  436.             'desc' => 'Enter Special Skills',
  437.             'id' => $prefix . 'special_skills',
  438.             'type' => 'wysiwyg'
  439.         ),
  440.     )
  441. );
  442.  
  443. //Start Recipes Meta Fields
  444. $meta_boxes[] = array(
  445.     'id' => 'Recipe Details',
  446.     'title' => 'Recipe Details',
  447.     'pages' => array('recipes'), // post type
  448.     'context' => 'normal',
  449.     'priority' => 'low',
  450.     'show_names' => false, // Show field names on the left
  451.     'fields' => array(
  452.         array(
  453.             'name' => 'Main Ingredient',
  454.             'desc' => 'Main Ingredient: Chicken, Beef, Pasta, etc...',
  455.             'id' => $prefix . 'main_ingredient',
  456.             'type' => 'text_medium'
  457.         ),
  458.         array(
  459.             'name' => 'Course',
  460.             'desc' => 'Select Course',
  461.             'id' => $prefix . 'course',
  462.             'type' => 'select',
  463.             'options' => array(
  464.                 array('name' => 'Appetizer', 'value' => 'Appetizer'),
  465.                 array('name' => 'Main Course', 'value' => 'Main Course'),
  466.                 array('name' => 'Side Dish', 'value' => 'Side Dish'),
  467.                 array('name' => 'Snack', 'value' => 'Snack'),
  468.                 array('name' => 'Beverage', 'value' => 'Beverage'),
  469.             )
  470.         ),
  471.         array(
  472.             'name' => 'Best Use',
  473.             'desc' => 'Select Best Use',
  474.             'id' => $prefix . 'best_use',
  475.             'type' => 'select',
  476.             'options' => array(
  477.                 array('name' => 'Day Hiking', 'value' => 'Day Hiking'),
  478.                 array('name' => 'Backpacking', 'value' => 'Backpacking'),
  479.                 array('name' => 'Camping', 'value' => 'Camping'),
  480.                 array('name' => 'Multi-use', 'value' => 'Multi-use'),
  481.             )
  482.         ),
  483.         array(
  484.             'name' => 'Level',
  485.             'desc' => 'Select Level',
  486.             'id' => $prefix . 'level',
  487.             'type' => 'select',
  488.             'options' => array(
  489.                 array('name' => 'Easy - like Mac &amp; Cheese', 'value' => 'Easy - like Mac &amp; Cheese'),
  490.                 array('name' => 'Moderate - requires some skills', 'value' => 'Moderate - requires some skills'),
  491.                 array('name' => 'Difficult - should only be attempted by an Iron Chef', 'value' => 'Difficult - should only be attempted by an Iron Chef'),
  492.             )
  493.         ),
  494.         array(
  495.             'name' => 'Meal',
  496.             'desc' => 'Select Meal',
  497.             'id' => $prefix . 'meal',
  498.             'type' => 'select',
  499.             'options' => array(
  500.                 array('name' => 'Breakfast', 'value' => 'Breakfast'),
  501.                 array('name' => 'Lunch', 'value' => 'Lunch'),
  502.                 array('name' => 'Dinner', 'value' => 'Dinner'),
  503.                 array('name' => 'On The Move', 'value' => 'On the Move'),
  504.                 array('name' => 'Multi-use', 'value' => 'Multi-use'),
  505.             )
  506.         ),
  507.         array(
  508.             'name' => 'Servings',
  509.             'desc' => 'How many people will this recipe feed?',
  510.             'id' => $prefix . 'servings',
  511.             'type' => 'text_small'
  512.         ),
  513.     )
  514. );
  515.  
  516. $meta_boxes[] = array(
  517.     'id' => 'prep_time',
  518.     'title' => 'Prep Time',
  519.     'pages' => array('recipes'), // post type
  520.     'context' => 'normal',
  521.     'priority' => 'low',
  522.     'show_names' => false, // Show field names on the left
  523.     'fields' => array(
  524.         array(
  525.             'name' => 'Prep Time Hours',
  526.             'desc' => 'Enter Hours',
  527.             'id' => $prefix . 'prep_time_hours',
  528.             'type' => 'text_small'
  529.         ),
  530.         array(
  531.             'name' => 'Prep Time Minutes',
  532.             'desc' => 'Enter Minutes',
  533.             'id' => $prefix . 'prep_time_minutes',
  534.             'type' => 'text_small'
  535.         ),
  536.     )
  537. );
  538.  
  539. $meta_boxes[] = array(
  540.     'id' => 'cook_time',
  541.     'title' => 'Cook Time',
  542.     'pages' => array('recipes'), // post type
  543.     'context' => 'normal',
  544.     'priority' => 'low',
  545.     'show_names' => false, // Show field names on the left
  546.     'fields' => array(
  547.         array(
  548.             'name' => 'Cook Time Hours',
  549.             'desc' => 'Enter Hours',
  550.             'id' => $prefix . 'cook_time_hours',
  551.             'type' => 'text_small'
  552.         ),
  553.         array(
  554.             'name' => 'Cook Time Minutes',
  555.             'desc' => 'Enter Minutes',
  556.             'id' => $prefix . 'cook_time_minutes',
  557.             'type' => 'text_small'
  558.         ),
  559.     )
  560. );
  561.  
  562. $meta_boxes[] = array(
  563.     'id' => 'cooking_ingredients',
  564.     'title' => 'Cooking Ingredients',
  565.     'pages' => array('recipes'), // post type
  566.     'context' => 'normal',
  567.     'priority' => 'low',
  568.     'show_names' => false, // Show field names on the left
  569.     'fields' => array(
  570.         array(
  571.             'name' => 'Cooking Ingredients',
  572.             'desc' => 'Please add 1 ingredient per line',
  573.             'id' => $prefix . 'cooking_ingredients',
  574.             'type' => 'wysiwyg'
  575.         ),
  576.     )
  577. );
  578.  
  579. $meta_boxes[] = array(
  580.     'id' => 'cooking_instructions',
  581.     'title' => 'Cooking Instructions',
  582.     'pages' => array('recipes'), // post type
  583.     'context' => 'normal',
  584.     'priority' => 'low',
  585.     'show_names' => false, // Show field names on the left
  586.     'fields' => array(
  587.         array(
  588.             'name' => 'Cooking Instructions',
  589.             'desc' => 'Enter Cooking Instructions (Select the Ordered list button. 5th icon above)',
  590.             'id' => $prefix . 'cooking_instructions',
  591.             'type' => 'wysiwyg'
  592.         ),
  593.     )
  594. );
  595.  
  596. // Start Gear Reviews
  597. $meta_boxes[] = array(
  598.     'id' => 'gear_rating',
  599.     'title' => 'Rating',
  600.     'pages' => array('reviews'), // post type
  601.     'context' => 'side',
  602.     'priority' => 'low',
  603.     'show_names' => false, // Show field names on the left
  604.     'fields' => array(
  605.         array(
  606.             'name' => 'Gear Rating',
  607.             'desc' => 'Select Gear Rating',
  608.             'id' => $prefix . 'gear_rating',
  609.             'type' => 'select',
  610.             'options' => array(
  611.                 array('name' => '1', 'value' => '1'),
  612.                 array('name' => '2', 'value' => '2'),
  613.                 array('name' => '3', 'value' => '3'),
  614.                 array('name' => '4', 'value' => '4'),
  615.                 array('name' => '5', 'value' => '5'),
  616.             )
  617.  
  618.         ),
  619.     )
  620. );
  621.  
  622. $meta_boxes[] = array(
  623.     'id' => 'gear_price',
  624.     'title' => 'Price',
  625.     'pages' => array('reviews'), // post type
  626.     'context' => 'side',
  627.     'priority' => 'low',
  628.     'show_names' => false, // Show field names on the left
  629.     'fields' => array(
  630.         array(
  631.             'name' => 'Gear Price',
  632.             'desc' => 'Enter Gear Price',
  633.             'id' => $prefix . 'gear_price',
  634.             'type' => 'text_money'
  635.         ),
  636.     )
  637. );
  638.  
  639. $meta_boxes[] = array(
  640.     'id' => 'gear_best_use',
  641.     'title' => 'Best Use',
  642.     'pages' => array('reviews'), // post type
  643.     'context' => 'side',
  644.     'priority' => 'low',
  645.     'show_names' => false, // Show field names on the left
  646.     'fields' => array(
  647.         array(
  648.             'name' => 'Best Use',
  649.             'desc' => 'Select Best Use',
  650.             'id' => $prefix . 'gear_best_use',
  651.             'type' => 'select',
  652.             'options' => array(
  653.                 array('name' => 'Day Hiking', 'value' => 'Day Hiking'),
  654.                 array('name' => 'Backpacking', 'value' => 'Backpacking'),
  655.                 array('name' => 'Camping', 'value' => 'Camping'),
  656.                 array('name' => 'Multi-Use', 'value' => 'Multi-use'),
  657.             )
  658.  
  659.         ),
  660.     )
  661. );
  662.  
  663. $meta_boxes[] = array(
  664.     'id' => 'gear_location',
  665.     'title' => 'Where to Buy',
  666.     'pages' => array('reviews'), // post type
  667.     'context' => 'normal',
  668.     'priority' => 'low',
  669.     'show_names' => false, // Show field names on the left
  670.     'fields' => array(
  671.         array(
  672.             'name' => 'Where to Buy',
  673.             'desc' => 'Enter Location to Display',
  674.             'id' => $prefix . 'gear_location',
  675.             'type' => 'text_medium'
  676.         ),
  677.         array(
  678.             'name' => 'Where to Buy',
  679.             'desc' => 'Enter Destination Location Link',
  680.             'id' => $prefix . 'gear_location_link',
  681.             'type' => 'text_medium'
  682.         ),
  683.  
  684.     )
  685. );
  686.  
  687. $meta_boxes[] = array(
  688.     'id' => 'testing_results',
  689.     'title' => 'Results of Testing',
  690.     'pages' => array('reviews'), // post type
  691.     'context' => 'normal',
  692.     'priority' => 'low',
  693.     'show_names' => false, // Show field names on the left
  694.     'fields' => array(
  695.         array(
  696.             'name' => 'Testing Location',
  697.             'desc' => 'Enter where you tested this?  Specify National Park or use area.',
  698.             'id' => $prefix . 'testing_results_location',
  699.             'type' => 'text_medium'
  700.         ),
  701.  
  702.         array(
  703.             'name' => 'Time/Distance Tested',
  704.             'desc' => 'Enter how long you tested this or how many miles did you treked with it?',
  705.             'id' => $prefix . 'testing_results_distance',
  706.             'type' => 'text_medium'
  707.         ),
  708.        
  709.         array(
  710.             'name' => 'Testing Environment',
  711.             'desc' => 'Enter the conditions ex. Windy, rainy, muddy, high or low temps, type of terrain',
  712.             'id' => $prefix . 'testing_results_environment',
  713.             'type' => 'text_medium'
  714.         ),
  715.     )
  716. );
  717.  
  718. $meta_boxes[] = array(
  719.     'id' => 'bottom_line',
  720.     'title' => 'The Bottom Line',
  721.     'pages' => array('reviews'), // post type
  722.     'context' => 'normal',
  723.     'priority' => 'low',
  724.     'show_names' => false, // Show field names on the left
  725.     'fields' => array(
  726.         array(
  727.             'name' => 'The Bottom Line',
  728.             'desc' => 'Enter content for the bottom line',
  729.             'id' => $prefix . 'bottom_line',
  730.             'type' => 'wysiwyg'
  731.         ),
  732.     )
  733. );
  734.  
  735.  
  736.  
  737. require_once('lib/post-type/metabox/init.php');
  738.  
  739.  
  740.  
  741.  
  742.  
  743. function feeds_reviews() { ?>
  744. <div id="feeds-feedburner">
  745.     <a href="http://feeds.feedburner.com/TrailSherpaReviews" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/TrailSherpaReviews" rel="alternate" type="application/rss+xml">Subscribe to Gear Reviews
  746.     </a> &nbsp;|&nbsp;<a href="http://feedburner.google.com/fb/a/mailverify?uri=TrailSherpaReviews&amp;loc=en_US">Subscribe to Gear Reviews by Email</a>
  747. </div>
  748.    
  749. <?php }
  750.  
  751. function feeds_recipes() { ?>
  752. <div id="feeds-feedburner">
  753.     <a href="http://feeds.feedburner.com/TrailSherpaRecipes" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/TrailSherpaRecipes" rel="alternate" type="application/rss+xml">Subscribe to Recipes
  754.     </a> &nbsp;|&nbsp;<a href="http://feedburner.google.com/fb/a/mailverify?uri=TrailSherpaRecipes&amp;loc=en_US">Subscribe to Recipes by Email</a>
  755. </div>
  756.    
  757. <?php }
  758.  
  759. function feeds_reports() { ?>
  760. <div id="feeds-feedburner">
  761.     <a href="http://feeds.feedburner.com/TrailSherpaTrailReports" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/TrailSherpaTrailReports" rel="alternate" type="application/rss+xml">Subscribe to Trail Reports</a> &nbsp;|&nbsp;<a href="http://feedburner.google.com/fb/a/mailverify?uri=TrailSherpaTrailReports&amp;loc=en_US">Subscribe Trail Reports by Email</a>
  762. </div>
  763.    
  764. <?php }
  765.  
  766. if ( current_user_can('contributor') && !current_user_can('upload_files') )
  767.     add_action('admin_init', 'allow_contributor_uploads');
  768.  
  769. function allow_contributor_uploads() {
  770.     $contributor = get_role('contributor');
  771.     $contributor->add_cap('upload_files');
  772. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement