Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /************ Home slider meta post ****************/
- add_action('admin_init','quality_init');
- function quality_init()
- {
- add_meta_box('home_slider_meta', 'Description', 'quality_meta_slider', 'quality_slider', 'normal', 'high');
- add_meta_box('home_service_meta', 'featured Service', 'quality_meta_service', 'quality_service', 'normal', 'high');
- add_meta_box('home_portfolio_meta', 'Custom Portfolio Details', 'quality_meta_portfolio', 'quality_portfolio', 'normal', 'high');
- add_meta_box('home_portfolio_meta_details', 'Portfolio Featured Details', 'quality_meta_portfolio_details', 'quality_portfolio', 'normal', 'high');
- add_meta_box('quality_page', 'Page Info', 'page_layout_meta', 'page', 'normal', 'high');
- add_meta_box('quality_post', 'Post Info', 'post_layout_meta', 'post', 'normal', 'high');
- add_meta_box('quality_testimonilas', 'Description', 'quality_meta_testimonial', 'quality_testimonial', 'normal', 'high');
- add_meta_box('quality_team', 'Detail', 'quality_meta_team', 'quality_team', 'normal', 'high');
- add_meta_box('quality_clientstrip', 'Detail', 'quality_meta_client', 'quality_clientstrip', 'normal', 'high');
- add_action('save_post','quality_meta_save');
- }
- function post_layout_meta()
- {
- global $post ;
- $post_description =sanitize_text_field( get_post_meta( get_the_ID(), 'post_description', true ));
- $content_post_layout=sanitize_text_field( get_post_meta( get_the_ID(), 'content_post_layout', true ));
- if(!$content_post_layout) { $content_post_layout= "fullwidth"; }
- ?>
- <p><label><?php _e('Post Description','quality');?></label></p>
- <p><input class="inputwidth" name="post_description" id="post_description" style="width: 480px" placeholder="Enter post description " type="text" value="<?php if (!empty($post_description)) echo esc_attr($post_description);?>"></input></p>
- <p>
- <input id="radio1" <?php if($content_post_layout == "fullwidth") { echo "checked"; } ?> type="radio" name="content_post_layout" value="fullwidth">
- <label for="radio1" <?php if($content_post_layout == "fullwidth") { echo "checked"; } ?> ><img src="<?php echo WEBRITI_TEMPLATE_DIR_URI; ?>/images/full-width.png"></label>
- <input id="radio2" <?php if($content_post_layout == "fullwidth_left") { echo "checked"; } ?> type="radio" name="content_post_layout" value="fullwidth_left">
- <label for="radio2" <?php if($content_post_layout == "fullwidth_left") { echo "checked"; } ?> ><img src="<?php echo WEBRITI_TEMPLATE_DIR_URI; ?>/images/left-sidebar.png"></label>
- <input id="radio3" <?php if($content_post_layout == "fullwidth_right") { echo "checked"; } ?> type="radio" name="content_post_layout" value="fullwidth_right">
- <label for="radio3" <?php if($content_post_layout == "fullwidth_right") { echo "checked"; } ?> ><img src="<?php echo WEBRITI_TEMPLATE_DIR_URI; ?>/images/right-sidebar1.png"></label>
- </p>
- <?php
- }
- function page_layout_meta()
- {
- global $post ;
- $page_description =sanitize_text_field( get_post_meta( get_the_ID(), 'page_description', true ));
- $content_page_layout=sanitize_text_field( get_post_meta( get_the_ID(), 'content_page_layout', true ));
- if(!$content_page_layout) { $content_page_layout= "fullwidth"; }
- ?>
- <p><label><?php _e('Page Description','quality');?></label></p>
- <p><input class="inputwidth" name="page_description" id="page_description" style="width: 480px" placeholder="Enter page description " type="text" value="<?php if (!empty($page_description)) echo esc_attr($page_description);?>"> </input></p>
- <p><label><?php _e('Page Layout','quality');?></label></p>
- <p>
- <input id="radio1" <?php if($content_page_layout == "fullwidth") { echo "checked"; } ?> type="radio" name="content_page_layout" value="fullwidth">
- <label for="radio1" <?php if($content_page_layout == "fullwidth") { echo "checked"; } ?> ><img src="<?php echo WEBRITI_TEMPLATE_DIR_URI; ?>/images/full-width.png"></label>
- <input id="radio2" <?php if($content_page_layout == "fullwidth_left") { echo "checked"; } ?> type="radio" name="content_page_layout" value="fullwidth_left">
- <label for="radio2" <?php if($content_page_layout == "fullwidth_left") { echo "checked"; } ?> ><img src="<?php echo WEBRITI_TEMPLATE_DIR_URI; ?>/images/left-sidebar.png"></label>
- <input id="radio3" <?php if($content_page_layout == "fullwidth_right") { echo "checked"; } ?> type="radio" name="content_page_layout" value="fullwidth_right">
- <label for="radio3" <?php if($content_page_layout == "fullwidth_right") { echo "checked"; } ?> ><img src="<?php echo WEBRITI_TEMPLATE_DIR_URI; ?>/images/right-sidebar1.png"></label>
- <p/>
- <?php
- }
- // code for slider banner description
- function quality_meta_slider()
- { global $post ;
- $slider_title = sanitize_text_field( get_post_meta( get_the_ID(), 'slider_title', true ));
- $slider_description = sanitize_text_field( get_post_meta( get_the_ID(), 'slider_description', true ));
- $slider_button_text = sanitize_text_field( get_post_meta( get_the_ID(), 'slider_button_text', true ));
- $slider_button_link = sanitize_text_field( get_post_meta( get_the_ID(), 'slider_button_link', true ));
- $slider_button_target = sanitize_text_field( get_post_meta( get_the_ID(), 'slider_button_target', true ));
- ?>
- <p><label><?php _e('Slider Title','quality');?></label></p>
- <p><input class="inputwidth" name="slider_title" id="slider_title" style="width: 480px" placeholder="Enter slider title " type="text" value="<?php if (!empty($slider_title)) echo esc_attr($slider_title);?>"> </input></p>
- <p><h4 class="heading"><?php _e('Slider Description','quality'); ?> </h4>
- <p><input class="inputwidth" name="slider_description" id="slider_description" style="width: 480px" placeholder="Enter the slider description" type="text" value="<?php if (!empty($slider_description)) echo esc_attr($slider_description);?>"> </input></p>
- <p><h4 class="heading"><?php _e('Slider Button Text','quality'); ?> </h4>
- <p><input class="inputwidth" name="slider_button_text" id="slider_button_text" style="width: 480px" placeholder="Enter the slider Button Text" type="text" value="<?php if (!empty($slider_button_text)) echo esc_attr($slider_button_text);?>"> </input></p>
- <p><h4 class="heading"><?php _e('Slider button Link','quality');?></h4>
- <p><input type="checkbox" id="slider_button_target" name="slider_button_target" <?php if($slider_button_target) echo "checked"; ?> ><?php _e('Open link in a new window/tab','quality'); ?></p>
- <p><input class="inputwidth" name="slider_button_link" id="slider_button_link" style="width: 480px" placeholder="Enter the slider button link" type="text" value="<?php if (!empty($slider_button_link)) echo esc_attr($slider_button_link);?>"> </input></p>
- <?php
- }
- // code for service description
- function quality_meta_service()
- { global $post ;
- $service_icon_image =sanitize_text_field( get_post_meta( get_the_ID(), 'service_icon_image', true ));
- $meta_service_link =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_service_link', true ));
- $meta_service_target =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_service_target', true ));
- $service_description_text =sanitize_text_field( get_post_meta( get_the_ID(), 'service_description_text', true ));
- $service_readmore_text =sanitize_text_field( get_post_meta( get_the_ID(), 'service_readmore_text', true ));
- ?>
- <p><h4 class="heading"><?php _e('Service Icon (Using Font Awesome icons name) like: fa-rub .','quality');?> <label style="margin-left:10px;"><a target="_blank" href="http://fontawesome.io/icons/"> <?php _e('Get your fontawesome icons.','quality') ;?></a></label></h4>
- <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>
- <p><h4 class="heading"><?php _e('Service Link','quality'); ?></h4>
- <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','quality'); ?></p>
- <p><input class="inputwidth" name="meta_service_link" id="meta_service_link" style="width: 480px" placeholder="Enter the service link" type="text" value="<?php if (!empty($meta_service_link)) echo esc_attr($meta_service_link);?>"> </input></p>
- <p><h4 class="heading"><?php _e('Service Description','quality'); ?></h4>
- <p><textarea name="service_description_text" id="service_description_text" style="width: 480px; height: 56px; padding: 0px;" placeholder="Enter Description for your service" rows="3" cols="10" ><?php if (!empty($service_description_text)) echo esc_textarea( $service_description_text ); ?></textarea></p>
- <p><h4 class="heading"><?php _e('Service Read More Text','quality'); ?></h4>
- <p><input class="inputwidth" name="service_readmore_text" id="service_readmore_text" style="width: 480px" placeholder="Enter the service Read More text" type="text" value="<?php if (!empty($service_readmore_text)) echo esc_attr($service_readmore_text);?>"> </input></p>
- <?php }
- // code for project description
- function quality_meta_portfolio()
- { global $post ;
- $meta_project_target =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_project_target', true ));
- $portfolio_project_summary =sanitize_text_field( get_post_meta( get_the_ID(), 'portfolio_project_summary', true ));
- $meta_project_link =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_project_link', true ));
- ?>
- <p><h4 class="heading"><?php _e('Portfolio / Project Link','quality');?></h4>
- <p><input class="inputwidth" name="meta_project_link" id="meta_project_link" style="width: 480px" placeholder="Enter the project / portfolio link" type="text" value="<?php if (!empty($meta_project_link)) echo esc_attr($meta_project_link);?>"> </input></p>
- <p><input type="checkbox" id="meta_project_target" name="meta_project_target" <?php if($meta_project_target) echo "checked"; ?> ><?php _e('Open link in a new window/tab','quality'); ?></p>
- <p><h4 class="heading"><?php _e('Page Info','quality');?></h4>
- <p><input class="inputwidth" name="portfolio_project_summary" id="portfolio_project_summary" style="width: 480px" placeholder="Enter the single line page info" type="text" value="<?php if (!empty($portfolio_project_summary)) echo esc_attr($portfolio_project_summary);?>"> </input></p>
- <?php }
- function quality_meta_portfolio_details()
- { global $post ;
- $portfolio_client_project_title =sanitize_text_field( get_post_meta( get_the_ID(), 'portfolio_client_project_title', true ));
- $portfolio_project_visit_site =sanitize_text_field( get_post_meta( get_the_ID(), 'portfolio_project_visit_site', true ));
- $portfolio_project_button_text =sanitize_text_field( get_post_meta( get_the_ID(), 'portfolio_project_button_text', true ));
- $meta_button_link =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_button_link', true ));
- $meta_button_target =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_button_target', true ));
- ?>
- <p><h4 class="heading"><?php _e('Your clients','quality');?></h4>
- <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>
- <p><h4 class="heading"><?php _e('Visit Website URL','quality');?></h4>
- <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>
- <p><h4 class="heading"><?php _e('Button Text','quality');?></h4>
- <p><input class="inputwidth" name="portfolio_project_button_text" id="portfolio_project_button_text" style="width: 480px" placeholder="Enter the button text" type="text" value="<?php if (!empty($portfolio_project_button_text)) echo esc_attr($portfolio_project_button_text);?>"> </input></p>
- <p><h4 class="heading"><?php _e('Button Link','quality');?></h4>
- <p><input class="inputwidth" name="meta_button_link" id="meta_button_link" style="width: 480px" placeholder="Enter the button link" type="text" value="<?php if (!empty($meta_button_link)) echo esc_attr($meta_button_link);?>"> </input></p>
- <p><input type="checkbox" id="meta_button_target" name="meta_button_target" <?php if($meta_button_target) echo "checked"; ?> ><?php _e('Open link in a new window/tab','quality'); ?></p>
- <?php
- }
- //Meta boxes for testimonials*/
- function quality_meta_testimonial()
- { global $post ;
- $description_meta_save=sanitize_text_field( get_post_meta( get_the_ID(), 'description_meta_save', true ));
- $author_designation_meta_save=sanitize_text_field( get_post_meta( get_the_ID(), 'author_designation_meta_save', true ));
- ?>
- <p><label><?php _e('Testimonial Description','quality');?></label> </p>
- <p><textarea name="description_meta_save" id="description_meta_save" style="width: 480px; height: 56px; padding: 0px;" placeholder="Enter Desc for your Testimonial" rows="3" cols="10" ><?php if (!empty($description_meta_save)) echo esc_textarea( $description_meta_save ); ?></textarea></p>
- <p><label><?php _e('Testimonial Author Designation','quality');?></label></p>
- <p><input class="inputwidth" name="author_designation_meta_save" id="author_designation_meta_save" style="width: 480px;" placeholder="Author Designation" type="text" value="<?php if (!empty($author_designation_meta_save)) echo esc_attr($author_designation_meta_save);?>"></input></p>
- <?php
- }
- function quality_meta_team()
- {
- global $post;
- $designation_meta_save = sanitize_text_field( get_post_meta( get_the_ID(), 'designation_meta_save', true ));
- $description_meta_save = get_post_meta( get_the_ID(), 'description_meta_save', true );
- $fb_meta_save = sanitize_text_field( get_post_meta( get_the_ID(), 'fb_meta_save', true ));
- $fb_meta_save_chkbx = sanitize_text_field( get_post_meta( get_the_ID(), 'fb_meta_save_chkbx', true ));
- $twt_meta_save = sanitize_text_field( get_post_meta( get_the_ID(), 'twt_meta_save', true ));
- $twt_meta_save_chkbx = sanitize_text_field( get_post_meta( get_the_ID(), 'twt_meta_save_chkbx', true ));
- $lnkd_meta_save = sanitize_text_field( get_post_meta( get_the_ID(), 'lnkd_meta_save', true ));
- $lnkd_meta_save_chkbx = sanitize_text_field( get_post_meta( get_the_ID(), 'lnkd_meta_save_chkbx', true ));
- $google_meta_save = sanitize_text_field( get_post_meta( get_the_ID(), 'google_meta_save', true ));
- $google_meta_save_chkbx = sanitize_text_field( get_post_meta( get_the_ID(), 'google_meta_save_chkbx', true ));
- ?>
- <p><h4 class="heading"><?php _e('Members Designation','quality');?></h4></p>
- <p><input class="inputwidth" name="designation_meta_save" id="designation_meta_save" style="width: 480px" placeholder="Enter Member's Designation Here" type="text" value="<?php if (!empty($designation_meta_save)) echo esc_attr($designation_meta_save);?>"></input></p>
- <p><h4 class="heading"><?php _e('Role Description','quality');?></h4></p>
- <p><textarea name="description_meta_save" id="description_meta_save" style="width: 480px; height: 56px; padding: 0px;" placeholder="Describe the Roles for the member(Use max-word 140)" rows="3" cols="10" ><?php if (!empty($description_meta_save)) echo esc_textarea( $description_meta_save ); ?></textarea></p>
- <p><h4 class="heading"><span><?php _e('Social Media Setting','quality');?></span></h4>
- <p><h4 class="heading"><label><?php _e('Facebook','quality');?></label></h4>
- <input style="width:80%;padding: 10px;" name="fb_meta_save" id="fb_meta_save" placeholder="Enter Your Fb's URL in https formate" value="<?php if(!empty($fb_meta_save)) echo esc_attr($fb_meta_save); ?>"/>
- <input type="checkbox" name="fb_meta_save_chkbx" value="1"<?php if(isset($fb_meta_save_chkbx)) checked($fb_meta_save_chkbx,'1') ; ?> /></p>
- <p><h4 class="heading"><?php _e('Twitter Url','quality')?></h4>
- <p><input style="width:80%; padding: 10px;" name="twt_meta_save" id="twt_meta_save" placeholder="Enter Your Twitter's URL in https formate" value="<?php if(!empty($twt_meta_save)) echo esc_attr($twt_meta_save); ?>"/>
- <input type="checkbox" name="twt_meta_save_chkbx" value="1"<?php if(isset($twt_meta_save_chkbx)) checked($twt_meta_save_chkbx,'1') ; ?> /></p>
- <p><h4 class="heading"><label><?php _e('LinkedIn Url','quality');?></label></h4>
- <input style="width:80%;padding: 10px;" name="lnkd_meta_save" id="lnkd_meta_save" placeholder="Enter Your LinkedIn's URL in https formate" value="<?php if(!empty($lnkd_meta_save)) echo esc_attr($lnkd_meta_save); ?>"/>
- <input type="checkbox" name="lnkd_meta_save_chkbx" value="1" <?php if(isset($lnkd_meta_save_chkbx)) checked($lnkd_meta_save_chkbx,'1') ; ?> /></p>
- <p><h4 class="heading"><label><?php _e('Google Url','quality');?></label></h4>
- <input style="width:80%; padding: 10px;" name="google_meta_save" id="google_meta_save" placeholder="Enter Your Google's URL in https formate" value="<?php if(!empty($google_meta_save)) echo esc_attr($google_meta_save); ?>"/>
- <input type="checkbox" name="google_meta_save_chkbx" value="1" <?php if(isset($google_meta_save_chkbx)) checked($google_meta_save_chkbx,'1') ; ?> /></p>
- <?php
- }
- function quality_meta_client()
- {
- global $post;
- $client_link = sanitize_text_field( get_post_meta( get_the_ID(), 'clientstrip_link', true ));
- $meta_client_target =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_client_target', true ));
- ?>
- <p><h4 class="heading"><?php _e('Enter URL link','quality');?></h4>
- <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>
- <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','quality'); ?></p>
- <p><label><?php _e('Upload Client image using Feature Image.Best fit scenario is using 130 X 130 px image.','quality'); ?></label></p>
- <?php
- }
- function quality_meta_save($post_id)
- {
- if((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit']))
- return;
- if ( ! current_user_can( 'edit_page', $post_id ) )
- { return ; }
- if(isset($_POST['post_ID']))
- {
- $post_ID = $_POST['post_ID'];
- $post_type=get_post_type($post_ID);
- if($post_type=='quality_slider'){
- update_post_meta($post_ID, 'slider_title', sanitize_text_field($_POST['slider_title']));
- update_post_meta($post_ID, 'slider_description', sanitize_text_field($_POST['slider_description']));
- update_post_meta($post_ID, 'slider_button_text', sanitize_text_field($_POST['slider_button_text']));
- update_post_meta($post_ID, 'slider_button_link', sanitize_text_field($_POST['slider_button_link']));
- update_post_meta($post_ID, 'slider_button_target', sanitize_text_field($_POST['slider_button_target']));
- }
- else if($post_type=='quality_service'){
- update_post_meta($post_ID, 'service_icon_image', sanitize_text_field($_POST['service_icon_image']));
- update_post_meta($post_ID, 'meta_service_link', sanitize_text_field($_POST['meta_service_link']));
- update_post_meta($post_ID, 'meta_service_target', sanitize_text_field($_POST['meta_service_target']));
- update_post_meta($post_ID, 'service_description_text', sanitize_text_field($_POST['service_description_text']));
- update_post_meta($post_ID, 'service_readmore_text', sanitize_text_field($_POST['service_readmore_text']));
- }
- else if($post_type=='quality_portfolio'){
- update_post_meta($post_ID, 'portfolio_client_project_title', sanitize_text_field($_POST['portfolio_client_project_title']));
- update_post_meta($post_ID, 'meta_project_target', sanitize_text_field($_POST['meta_project_target']));
- update_post_meta($post_ID, 'meta_project_link', sanitize_text_field($_POST['meta_project_link']));
- update_post_meta($post_ID, 'portfolio_project_visit_site', sanitize_text_field($_POST['portfolio_project_visit_site']));
- update_post_meta($post_ID, 'portfolio_project_button_text', sanitize_text_field($_POST['portfolio_project_button_text']));
- update_post_meta($post_ID, 'portfolio_project_summary', sanitize_text_field($_POST['portfolio_project_summary']));
- update_post_meta($post_ID, 'meta_button_target', sanitize_text_field($_POST['meta_button_target']));
- update_post_meta($post_ID, 'meta_button_link', sanitize_text_field($_POST['meta_button_link']));
- }
- else if($post_type=='page'){
- update_post_meta($post_ID, 'page_description', sanitize_text_field($_POST['page_description']));
- update_post_meta($post_ID, 'content_page_layout', sanitize_text_field($_POST['content_page_layout']));
- }
- elseif($post_type=='post'){
- update_post_meta($post_ID, 'post_description', sanitize_text_field($_POST['post_description']));
- update_post_meta($post_ID, 'content_post_layout', sanitize_text_field($_POST['content_post_layout']));
- }
- else if($post_type=='quality_testimonial') {
- update_post_meta($post_ID, 'description_meta_save', sanitize_text_field($_POST['description_meta_save']));
- update_post_meta($post_ID, 'author_designation_meta_save', sanitize_text_field($_POST['author_designation_meta_save']));
- }
- else if($post_type=='quality_team') {
- update_post_meta($post_ID, 'designation_meta_save', sanitize_text_field($_POST['designation_meta_save']));
- update_post_meta($post_ID, 'description_meta_save', $_POST['description_meta_save']);
- update_post_meta($post_ID, 'fb_meta_save', sanitize_text_field($_POST['fb_meta_save']));
- update_post_meta($post_ID, 'fb_meta_save_chkbx', sanitize_text_field($_POST['fb_meta_save_chkbx']));
- update_post_meta($post_ID, 'twt_meta_save', sanitize_text_field($_POST['twt_meta_save']));
- update_post_meta($post_ID, 'twt_meta_save_chkbx', sanitize_text_field($_POST['twt_meta_save_chkbx']));
- update_post_meta($post_ID, 'lnkd_meta_save', sanitize_text_field($_POST['lnkd_meta_save']));
- update_post_meta($post_ID, 'lnkd_meta_save_chkbx', sanitize_text_field($_POST['lnkd_meta_save_chkbx']));
- update_post_meta($post_ID, 'google_meta_save', sanitize_text_field($_POST['google_meta_save']));
- update_post_meta($post_ID, 'google_meta_save_chkbx', sanitize_text_field($_POST['google_meta_save_chkbx']));
- }
- elseif($post_type=='quality_clientstrip'){
- update_post_meta($post_ID, 'clientstrip_link', sanitize_text_field($_POST['client_link']));
- update_post_meta($post_ID, 'meta_client_target', sanitize_text_field($_POST['meta_client_target']));
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment