SHARE
TWEET

Untitled

a guest May 23rd, 2016 18 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php $current_options = get_option('hc_pro_options');
  2. $total = count($current_options['hc_faq'])+1;
  3. if(isset($_POST['webriti_settings_save_6']))
  4. {  
  5.     if($_POST['webriti_settings_save_6'] == 1)
  6.     {
  7.         if ( empty($_POST) || !wp_verify_nonce($_POST['webriti_gernalsetting_nonce_customization'],'webriti_customization_nonce_gernalsetting') )
  8.         {  print 'Sorry, your nonce did not verify.';   exit; }
  9.         else  
  10.         {      
  11.             $totalfaq = $_POST['totalfaq'];
  12.             $faqdata=array();
  13.             for($i=1; $i<$totalfaq; $i++)
  14.             {   $title='faq-title'.$i;
  15.                 $text='faq-text'.$i;                   
  16.                 $title = stripslashes($_POST[$title]);                 
  17.                 $text = stripslashes($_POST[$text]);                   
  18.                 $faqdata[$i]=array('faq-title'=>$title, 'faq-text'=>$text);
  19.                
  20.             }
  21.             $current_options['hc_faq']=$faqdata;
  22.             $current_options['totalfaq']=$totalfaq;
  23.             update_option('hc_pro_options',$current_options);
  24.         }
  25.     }
  26.     $tt=array();
  27.     $tt[] = array('faq-title' => ' Our Mission ?','faq-text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vehicula feugiat blandit. Nulla facilisi. Nulla tellus nisi, congue id.');
  28.     $tt[] = array('faq-title' => 'What We Do ?','faq-text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vehicula.');
  29.     $tt[] = array('faq-title' => 'What We Do ?','faq-text' => 'Lorem ipsum dolor sit amet, fgfgconsectetur adipiscing elit. Nulla vehicula.'); 
  30.     if($_POST['webriti_settings_save_6'] == 2)
  31.     {  
  32.         $current_options['hc_faq']=$tt;
  33.         $current_options['totalfaq']='';           
  34.         update_option('hc_pro_options',$current_options);
  35.     }
  36. }  
  37. ?>
  38. <script type="text/javascript">
  39.     fields = <?php if($total){ echo $total ; } else { echo "1"; } ; ?>;
  40.     function addInput()
  41.     {
  42.       jQuery('#hc_faq').append('<div class="section" id="faq-field'+fields+'"><h3>Faq-Title'+fields+'</h3><input class="webriti_inpute" type="text" id="faq-title'+fields+'" name="faq-title'+fields+'" value="" /><h3>Faq-Text'+fields+'</h3><textarea rows="8" cols="8" id="faq-text'+fields+'" name="faq-text'+fields+'" value="" type="text"></textarea></div>');
  43.       fields += 1;   
  44.       jQuery("#remove_button").show();
  45.       jQuery('#totalfaq').val(fields);
  46.     }
  47.     function remove_field()
  48.     {
  49.         if(fields!="1"){
  50.          fields=fields-1;
  51.         jQuery("#faq-field"+fields).remove();
  52.         jQuery('#totalfaq').val(fields);           
  53.         }
  54.     }
  55. </script>
  56. <div class="block ui-tabs-panel deactive" id="option-ui-id-6" >
  57.     <form method="post" id="webriti_theme_options_6">
  58.         <div id="heading">
  59.             <table style="width:100%;">
  60.                 <tr><td><h2><?php _e('FAQ','health');?></h2></td>
  61.                     <td style="width:30%;">
  62.                         <div class="webriti_settings_loding" id="webriti_loding_6_image"></div>
  63.                         <div class="webriti_settings_massage" id="webriti_settings_save_6_success" ><?php _e('Options data successfully Saved','health');?></div>
  64.                         <div class="webriti_settings_massage" id="webriti_settings_save_6_reset" ><?php _e('Options data successfully reset','health');?></div>
  65.                     </td>
  66.                     <td style="text-align:right;">
  67.                         <input class="reset-button btn" type="button" name="reset" value="Restore Defaults" onclick="webriti_option_data_reset('6');">
  68.                         <input class="btn btn-primary" type="button" value="Save Options" onclick="webriti_option_data_save('6')" >
  69.                     </td>
  70.                 </tr>
  71.             </table>   
  72.         </div>
  73.         <?php wp_nonce_field('webriti_customization_nonce_gernalsetting','webriti_gernalsetting_nonce_customization'); ?>
  74.         <div id="hc_faq">
  75.         <?php $i=1;
  76.             foreach($current_options['hc_faq'] as $tt)
  77.             {   ?>
  78.                 <div class="section" id="faq-field<?php echo $i ?>">
  79.                     <h3>Faq-Title<?php echo $i ?></h3>
  80.                     <input class="webriti_inpute" type="text" id="faq-title<?php echo $i ?>" name="faq-title<?php echo $i ?>" value=" <?php echo $tt['faq-title']; ?>" />
  81.                     <span class="explain"><?php _e('Enter the Faq Title.','health'); ?></span>
  82.                     <h3>Faq-Text<?php echo $i ?></h3><textarea rows="8" cols="8" id="faq-text<?php echo $i ?>" name="faq-text<?php echo $i;  ?>" ><?php echo  $tt['faq-text']; ?></textarea>
  83.                     <span class="explain"><?php _e('Enter the Faq Description.','health'); ?></span>
  84.                 </div> 
  85.             <?php   $i=$i+1;
  86.             }   ?>
  87.         </div>
  88.         <div class="setion" style="margin-bottom:30px;">
  89.             <a onclick="addInput()" href="#" class="btn btn-primary" name="add" id="more_faq" >Add FAQ Field</a>
  90.             <a onclick="remove_field()" href="#" class="btn btn-inverse"  id="remove_button" style="display:<?php if(!$total) { ?>none<?php } ?>;">Remove Last FAQ Field</a>       
  91.         </div>
  92.         <input type="hidden" class="webriti_inpute" type="text" id="totalfaq" name="totalfaq" value="<?php echo $total; ?> " />
  93.         <div id="button_section">
  94.             <input type="hidden" value="1" id="webriti_settings_save_6" name="webriti_settings_save_6" />
  95.             <input class="reset-button btn" type="button" name="reset" value="Restore Defaults" onclick="webriti_option_data_reset('6');">
  96.             <input class="btn btn-primary" type="button" value="Save Options" onclick="webriti_option_data_save('6')" >
  97.         </div>
  98.     </form>
  99. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top