Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'after_setup_theme', 'et_setup_theme' );
- if ( ! function_exists( 'et_setup_theme' ) ){
- function et_setup_theme(){
- global $themename, $shortname;
- $themename = "13floor";
- $shortname = "13floor";
- require_once(TEMPLATEPATH . '/epanel/custom_functions.php');
- require_once(TEMPLATEPATH . '/includes/functions/comments.php');
- require_once(TEMPLATEPATH . '/includes/functions/sidebars.php');
- load_theme_textdomain('13Floor',get_template_directory().'/lang');
- require_once(TEMPLATEPATH . '/epanel/options_13floor.php');
- require_once(TEMPLATEPATH . '/epanel/core_functions.php');
- require_once(TEMPLATEPATH . '/epanel/post_thumbnails_13floor.php');
- include(TEMPLATEPATH . '/includes/widgets.php');
- }
- }
- add_action('wp_head','et_portfoliopt_additional_styles',100);
- function et_portfoliopt_additional_styles(){ ?>
- <style type="text/css">
- #et_pt_portfolio_gallery { margin-left: -15px; }
- .et_pt_portfolio_item { margin-left: 9px; }
- .et_portfolio_small { margin-left: -55px !important; }
- .et_portfolio_small .et_pt_portfolio_item { margin-left: 25px !important; }
- .et_portfolio_large { margin-left: -8px !important; }
- .et_portfolio_large .et_pt_portfolio_item { margin-left: 6px !important; }
- .et_pt_portfolio_item h2 { color: #fff; }
- .et_portfolio_large .et_pt_portfolio_item { width: 412px; }
- .et_portfolio_large .et_portfolio_more_icon { left: 168px; }
- .et_portfolio_large .et_portfolio_zoom_icon { left: 208px; }
- </style>
- <?php }
- function register_main_menus() {
- register_nav_menus(
- array(
- 'primary-menu' => __( 'Primary Menu' )
- )
- );
- };
- if (function_exists('register_nav_menus')) add_action( 'init', 'register_main_menus' );
- if ( ! function_exists( 'et_list_pings' ) ){
- function et_list_pings($comment, $args, $depth) {
- $GLOBALS['comment'] = $comment; ?>
- <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> - <?php comment_excerpt(); ?>
- <?php }
- // update the '9' to the ID of your form
- add_action('gform_pre_render_9', 'add_surcharge_js');
- function add_surcharge_js($form){
- foreach($form['fields'] as &$field){
- if(strpos($field['cssClass'], 'surcharge') !== false) {
- $surcharge_field_id = $field['id'];
- continue;
- } else if($field['type'] == 'total'){
- $total_field_id = $field['id'];
- continue;
- }
- }
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function($){
- $("#gform_submit_button_<?php echo $form['id']; ?>").click(function(event){
- var surcharge_field = $("#input_<?php echo $form['id']; ?>_<?php echo $surcharge_field_id; ?>");
- var total = $("#input_<?php echo $form['id']; ?>_<?php echo $total_field_id; ?>").val();
- total = Math.round((total * 2.6)) / 100;
- $(surcharge_field).val(gformFormatMoney(total));
- gformCalculateTotalPrice(<?php echo $form['id']; ?>);
- });
- });
- </script>
- <?php }
- return $form;
- }
- add_filter("gform_address_city", "change_address_suburb", 10, 2);
- function change_address_suburb($label, $form_id){
- return "Suburb";
- }
- add_filter("gform_address_zip", "change_address_postcode", 10, 2);
- function change_address_postcode($label, $form_id){
- return "Post Code";
- }
- add_filter("gform_field_value_uuid", "get_unique");
- function get_unique(){
- $prefix = "MEFF"; // update the prefix here
- do {
- $unique = mt_rand();
- $unique = substr($unique, 0, 8);
- $unique = $prefix . $unique;
- } while (!check_unique($unique));
- return $unique;
- }
- function check_unique($unique) {
- global $wpdb;
- $table = $wpdb->prefix . 'rg_lead_detail';
- $form_id = 9; // update to the form ID your unique id field belongs to
- $field_id = 48; // update to the field ID your unique id is being prepopulated in
- $result = $wpdb->get_var("SELECT value FROM $table WHERE form_id = '$form_id' AND field_number = '$field_id' AND value = '$unique'");
- if(empty($result))
- return true;
- return false;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment