sdobwm

Untitled

Aug 7th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.38 KB | None | 0 0
  1. <?php
  2. /************ Home slider meta post ****************/
  3. add_action('admin_init','rambopro_slider_init');
  4. function rambopro_slider_init()
  5. {
  6. add_meta_box('home_slider_meta', 'Description', 'rambopro_meta_slider', 'rambopro_slider', 'normal', 'high');
  7. add_meta_box('home_service_meta', 'featured Service', 'rambopro_meta_service', 'rambopro_service', 'normal', 'high');
  8. add_meta_box('home_project_meta', 'Portfolio Featured Project Details', 'rambopro_meta_project', 'rambopro_project', 'normal', 'high');
  9. add_meta_box('home_project_team', 'Our Team', 'rambopro_meta_team', 'rambopro_team', 'normal', 'high');
  10. add_meta_box('home_project_client', 'Client Strip', 'rambopro_meta_client', 'rambopro_clientstrip', 'normal', 'high');
  11. add_meta_box('home_rambopro_testimonials', 'Testimonials', 'rambopro_meta_testmonials', 'rambopro_testimonial', 'normal', 'high');
  12.  
  13.  
  14. add_action('save_post','rambopro_meta_save');
  15. }
  16. // code for slider banner description
  17. function rambopro_meta_slider()
  18. { global $post ;
  19. $image_caption= ( get_post_meta( get_the_ID(), 'image_description', true ));
  20. $readmorelink = ( get_post_meta( get_the_ID(), 'readmore_link', true ));
  21. $readmorebutton = ( get_post_meta( get_the_ID(), 'readmore_button', true ));
  22. $meta_slider_target = ( get_post_meta( get_the_ID(), 'meta_slider_target', true ));
  23. ?>
  24. <p><label><?php _e('Image Caption','rambo');?></label> </p>
  25. <p><textarea name="meta_image_description" id="meta_image_description" style="width: 480px; height: 56px; padding: 0px;" placeholder="Enter slider description (Use max word length 150 words)" rows="3" cols="10" ><?php if (!empty($image_caption)) echo esc_textarea( $image_caption ); ?></textarea></p>
  26. <p><label><?php _e('Read More Button','rambo');?></label></p>
  27. <p><input class="inputwidth" name="readmore_button" id="readmore_button" style="width: 480px" placeholder="Enter text for button " type="text" value="<?php if (!empty($readmorebutton)) echo esc_attr($readmorebutton);?>"> </input></p>
  28. <p><label><?php _e('Read More Link','rambo');?></label></p>
  29. <p><input class="inputwidth" name="readmore_link" id="readmore_link" style="width: 480px;" placeholder="Enter link or url for button" type="text" value="<?php if (!empty($readmorelink)) echo esc_attr($readmorelink);?>"> </input></p>
  30. <p><input type="checkbox" id="meta_slider_target" name="meta_slider_target" <?php if($meta_slider_target) echo "checked"; ?> > <?php _e('Open link in a new window/tab','rambo'); ?></p>
  31. <?php
  32. }
  33.  
  34. // code for service description
  35. function rambopro_meta_service()
  36. { global $post ;
  37.  
  38. $service_icon_image =( get_post_meta( get_the_ID(), 'service_icon_image', true ));
  39. $meta_service_description =( get_post_meta( get_the_ID(), 'meta_service_description', true ));
  40. $meta_service_link =( get_post_meta( get_the_ID(), 'meta_service_link', true ));
  41. $meta_service_target =( get_post_meta( get_the_ID(), 'meta_service_target', true ));
  42.  
  43. ?>
  44. <p><h4 class="heading"><?php _e('Service Icon (Using Font Awesome icons name) like: fa-rub .','rambo');?> <label style="margin-left:10px;"><a target="_blank" href="http://fontawesome.io/icons/"> <?php _e('Get your fontawesome icons.','rambo') ;?></a></label></h4>
  45. <p><input class="inputwidth" name="service_icon_image" id="service_icon_image" style="width: 480px" placeholder="Enter the fontawesome icon" type="text" value="<?php if (!empty($service_icon_image)) echo esc_attr($service_icon_image);?>"> </input></p>
  46. <p><h4 class="heading"><?php _e('Enter the service icon link','rambo');?></h4></p>
  47. <p><input style="width:600px;" name="meta_service_link" id="meta_service_link" placeholder="Enter the service icon link" type="text" value="<?php if (!empty($meta_service_link)) echo esc_attr($meta_service_link);?>"></p>
  48. <p><input type="checkbox" id="meta_service_target" name="meta_service_target" <?php if($meta_service_target) echo "checked"; ?> > <?php _e('Open link in a new window/tab','rambo'); ?></p>
  49. <p><h4 class="heading"><?php _e('Service Descritpion','rambo');?></h4>
  50. <p><textarea name="meta_service_description" id="meta_service_description" style="width: 480px; height: 56px; padding: 0px;" placeholder="Enter the Service description (Use max-word 115)" rows="3" cols="10" ><?php if (!empty($meta_service_description)) echo esc_textarea( $meta_service_description ); ?></textarea></p>
  51. <?php }
  52.  
  53. // code for project description
  54. function rambopro_meta_project()
  55. { global $post ;
  56. $portfolio_client_project_title =( get_post_meta( get_the_ID(), 'portfolio_client_project_title', true ));
  57. $portfolio_project_skills =( get_post_meta( get_the_ID(), 'portfolio_project_skills', true ));
  58. $portfolio_project_tags =( get_post_meta( get_the_ID(), 'portfolio_project_tags', true ));
  59. $portfolio_project_visit_site =( get_post_meta( get_the_ID(), 'portfolio_project_visit_site', true ));
  60. $portfolio_project_link =( get_post_meta( get_the_ID(), 'portfolio_project_link', true ));
  61. $portfolio_project_target =( get_post_meta( get_the_ID(), 'portfolio_project_target', true ));
  62. ?>
  63. <p><h4 class="heading"><?php _e('Your clients','rambo');?></h4>
  64. <p><input class="inputwidth" name="portfolio_client_project_title" id="portfolio_client_project_title" style="width: 480px" placeholder="Enter the client title, For example: Webriti" type="text" value="<?php if (!empty($portfolio_client_project_title)) echo esc_attr($portfolio_client_project_title);?>"> </input></p>
  65.  
  66. <p><h4 class="heading"><?php _e('Client Skills','rambo');?></h4>
  67. <p><input class="inputwidth" name="portfolio_project_skills" id="portfolio_project_skills" style="width: 480px" placeholder="Enter the skills, For example : Wordpress, Php, Theme Development" type="text" value="<?php if (!empty($portfolio_project_skills)) echo esc_attr($portfolio_project_skills);?>"> </input></p>
  68.  
  69. <p><h4 class="heading"><?php _e('Tags','rambo');?></h4>
  70. <p><input class="inputwidth" name="portfolio_project_tags" id="portfolio_project_tags" style="width: 480px" placeholder="Enter the tags, For example : Design, Prints, Business" type="text" value="<?php if (!empty($portfolio_project_tags)) echo esc_attr($portfolio_project_tags);?>"> </input></p>
  71.  
  72. <p><h4 class="heading"><?php _e('Client website Url','rambo');?></h4>
  73. <p><input class="inputwidth" name="portfolio_project_visit_site" id="portfolio_project_visit_site" style="width: 480px" placeholder="Enter visit site url, For example: : http://webriti.com" type="text" value="<?php if (!empty($portfolio_project_visit_site)) echo esc_attr($portfolio_project_visit_site);?>"> </input></p>
  74.  
  75. <p><h4 class="heading"><?php _e('Portfolio/Project Custom link','rambo');?></h4>
  76. <p><input style="width:600px;" name="portfolio_project_link" id="portfolio_project_link" placeholder="Enter the portfolio project link" type="text" value="<?php if (!empty($portfolio_project_link)) echo esc_attr($portfolio_project_link);?>"></p>
  77. <p><input type="checkbox" id="portfolio_project_target" name="portfolio_project_target" <?php if($portfolio_project_target) echo "checked"; ?> > <?php _e('Open link in a new window/tab','rambo'); ?></p>
  78.  
  79. <?php }
  80. function rambopro_meta_team()
  81. {
  82. global $post;
  83. $link = ( get_post_meta( get_the_ID(), 'team_link', true ));
  84. $designation = ( get_post_meta( get_the_ID(), 'team_designation', true ));
  85. $role_description = ( get_post_meta( get_the_ID(), 'team_role', true ));
  86. $meta_team_target =( get_post_meta( get_the_ID(), 'meta_team_target', true ));
  87. ?>
  88. <p><h4 class="heading"><?php _e('Member link','rambo');?></h4>
  89. <p><input class="inputwidth" name="link" id="link" style="width: 480px" placeholder="Enter Member's link Here" type="text" value="<?php if (!empty($link)) echo esc_attr($link);?>"></input></p>
  90. <p><input type="checkbox" id="meta_team_target" name="meta_team_target" <?php if($meta_team_target) echo "checked"; ?> > <?php _e('Open link in a new tab','rambo'); ?></p>
  91.  
  92. <p><h4 class="heading"><?php _e('Member Designation','rambo');?></h4>
  93. <p><input class="inputwidth" name="designation" id="designation" style="width: 480px" placeholder="Enter Member's Designation Here" type="text" value="<?php if (!empty($designation)) echo esc_attr($designation);?>"></input></p>
  94. <p><h4 class="heading"><?php _e('Role Descritpion','rambo');?></h4>
  95. <p><textarea name="role_description" id="role_description" style="width: 480px; height: 56px; padding: 0px;" placeholder="Describe the Roles for the member(Use max-word 115)" rows="3" cols="10" ><?php if (!empty($role_description)) echo esc_textarea( $role_description ); ?></textarea></p>
  96. <?php
  97. }
  98.  
  99. function rambopro_meta_client()
  100. {
  101. global $post;
  102. $client_link = ( get_post_meta( get_the_ID(), 'clientstrip_link', true ));
  103. $meta_client_target =( get_post_meta( get_the_ID(), 'meta_client_target', true ));
  104. ?>
  105. <p><h4 class="heading"><?php _e('Enter URL link','rambo');?></h4>
  106. <p><input class="inputwidth" name="client_link" id="client_link" style="width: 480px" placeholder="Enter url link Here" type="text" value="<?php if (!empty($client_link)) echo esc_attr($client_link);?>"></input></p>
  107. <p><input type="checkbox" id="meta_client_target" name="meta_client_target" <?php if($meta_client_target) echo "checked"; ?> > <?php _e('Open link in a new tab','rambo'); ?></p>
  108.  
  109.  
  110. <p><label><?php _e('Upload Client image using Feature Image.Best fit scenario is using 130 X 130 px image.','rambo'); ?></label></p>
  111. <?php
  112. }
  113.  
  114. // code for service description
  115. function rambopro_meta_testmonials()
  116. { global $post ;
  117. $testimonial_designation =( get_post_meta( get_the_ID(), 'testimonial_designation', true )); ?>
  118. <p><h4 class="heading"><?php _e('Testimonial Designation','rambo');?></h4>
  119. <p><input class="inputwidth" name="testimonial_designation" id="testimonial_designation" style="width: 480px" placeholder="Enter the testimonials designation" type="text" value="<?php if (!empty($testimonial_designation)) echo esc_attr($testimonial_designation);?>"> </input></p>
  120. <p><label><h4><?php _e('Upload Testimonial image using Featured Image','rambo');?></h4></label></p>
  121. <?php }
  122. function rambopro_meta_save($post_id)
  123. { if ( ! current_user_can( 'edit_page', $post_id ) )
  124. { return ; }
  125. if(isset( $_POST['post_ID']))
  126. {
  127. $post_ID = $_POST['post_ID'];
  128. $post_type=get_post_type($post_ID);
  129. if($post_type=='rambopro_slider'){
  130. update_post_meta($post_ID, 'image_description', ($_POST['meta_image_description']));
  131. update_post_meta($post_ID, 'readmore_button', ($_POST['readmore_button']));
  132. update_post_meta($post_ID, 'readmore_link', ($_POST['readmore_link']));
  133. update_post_meta($post_ID, 'meta_slider_target', ($_POST['meta_slider_target']));
  134. }
  135. elseif($post_type=='rambopro_service'){
  136. update_post_meta($post_ID, 'service_icon_image', ($_POST['service_icon_image']));
  137. update_post_meta($post_ID, 'meta_service_description', ($_POST['meta_service_description']));
  138. update_post_meta($post_ID, 'meta_service_link', ($_POST['meta_service_link']));
  139. update_post_meta($post_ID, 'meta_service_target', ($_POST['meta_service_target']));
  140. }
  141. elseif($post_type=='rambopro_project'){
  142. update_post_meta($post_ID, 'portfolio_client_project_title', ($_POST['portfolio_client_project_title']));
  143. update_post_meta($post_ID, 'portfolio_project_skills', ($_POST['portfolio_project_skills']));
  144. update_post_meta($post_ID, 'portfolio_project_tags', ($_POST['portfolio_project_tags']));
  145. update_post_meta($post_ID, 'portfolio_project_visit_site', ($_POST['portfolio_project_visit_site']));
  146. update_post_meta($post_ID, 'portfolio_project_link', ($_POST['portfolio_project_link']));
  147. update_post_meta($post_ID, 'portfolio_project_target', ($_POST['portfolio_project_target']));
  148. }
  149. elseif($post_type=='rambopro_team'){
  150. update_post_meta($post_ID, 'team_link', ($_POST['link']));
  151. update_post_meta($post_ID, 'team_designation', ($_POST['designation']));
  152. update_post_meta($post_ID, 'team_role', ($_POST['role_description']));
  153. update_post_meta($post_ID, 'meta_team_target', ($_POST['meta_team_target']));
  154. }
  155. elseif($post_type=='rambopro_testimonial'){
  156. update_post_meta($post_ID, 'testimonial_designation', ($_POST['testimonial_designation']));
  157. }
  158.  
  159. elseif($post_type=='rambopro_clientstrip'){
  160. update_post_meta($post_ID, 'clientstrip_link', ($_POST['client_link']));
  161. update_post_meta($post_ID, 'meta_client_target', ($_POST['meta_client_target']));
  162. }
  163. }
  164. }
  165. ?>
Add Comment
Please, Sign In to add comment