• Resolved ashishcruel

    (@ashishcruel)


    i am new to wordpress but unfortunately i messed up with the function.php and got error Parse error: syntax error, unexpected ‘}’, expecting ‘,’ or ‘;’ in /home/abidijasperit/public_html/wp-content/themes/twentythirteen-child/functions.php on line 336 please anybody. help ASAP

    my function code is:

    function for abidi

    <?php
    add_action(‘wp_ajax_request_a_quote’, ‘send_req_mail’);
    add_action(‘wp_ajax_nopriv_request_a_quote’, ‘send_req_mail’);

    function send_req_mail(){

    $fromName = $_POST[‘name’];
    $fromEmail = $_POST[’email’];
    $fromPhone = $_POST[‘phone’];
    $adminEmail = ‘[email protected]’; //get_option(‘admin_email’);

    $movingFrom = $_POST[‘originLatlng’];
    $movingTo = $_POST[‘destinationLatlng’];

    $distance = $_POST[‘distance’];
    $property = $_POST[‘property’];
    $propertyDetails = implode(‘
    ‘, array_map(function ($v, $k) { return str_replace(‘_’, ‘ ‘,ucfirst($k) ). ‘ :- ‘ . $v; }, $property, array_keys($property)));

    $message = “<p>Hi admin</p>
    <p>$fromName <$fromEmail> has just requested for quote on following property moving details.</p>
    Moving From :: $movingFrom
    Moving To :: $movingTo
    Distance :: $distance</p>
    <p><b>Property Details :: <b></p>
    <p>$propertyDetails</p>

    regards,
    “;
    $headers = ‘From: Abidi Services <[email protected]>’ . ‘\r\n’ .
    “X-Mailer: php\r\n”;
    $headers .= “MIME-Version: 1.0\r\n”;

    add_filter(‘wp_mail_content_type’, ‘set_html_content_type’);

    $send = wp_mail($adminEmail, ‘New Request for Quote’, $message, $headers);

    remove_filter(‘wp_mail_content_type’, ‘set_html_content_type’);

    echo ‘OK’; die;
    }

    add_action(‘wp_ajax_calculateprice’, ‘calculate_price’);
    add_action(‘wp_ajax_nopriv_calculateprice’, ‘calculate_price’);

    function calculate_price(){

    $distance = $_POST[‘distance’];
    $distanceMiles = (int)(str_replace(‘ mi’, ”, $distance));
    $distancerate = 0;

    if( $distanceMiles > 10) {

    $additionDistance = $distanceMiles – 10;
    $distanceSurplus = ceil($additionDistance/10);
    $distancerate = $distanceSurplus * 100;

    }

    $property = $_POST[‘property’];
    $propertyprice = getPropertyPrice($property);

    echo ( $distancerate + $propertyprice);

    die;
    }

    function getPropertyPrice($property){

    switch ($property[‘type’]) {
    case ‘appartment’:
    # code…
    $appartmentrate = 420;
    $roomrate = 120;
    $roomprice = $property[‘appartment_rooms’]*$roomrate;
    $floorrate = 72;
    $floorprice = $property[‘appartment_floors’]*$floorrate;
    return $appartmentrate+$roomprice+$floorprice;

    break;

    case ‘house’:
    $houserate = 780;
    $storyrate = 150;
    $storyprice = $storyrate*$property[‘house_story’];

    $sqfeetprice = 0;

    if( $property[‘house_sqfeet’]> 1000){
    $sqf = $property[‘house_sqfeet’] – 1000;
    $sqfn = ceil($sqf/500);
    $sqfeetprice = $sqfn*120;
    }
    return $houserate+$storyprice+$sqfeetprice;

    break;

    default:
    # code…
    $loftprice = 510;

    if( isset($property[‘loft_with_ataris’])){
    $ataris = 11;
    $atarisprice = $property[‘loft_floor’]*$ataris;
    $loftprice += $atarisprice;
    }

    if(isset($property[‘loft_with_elevators’])){
    $withelevatorsprce = 70 * $property[‘loft_floor’];
    $loftprice +=$withelevator;
    }

    if(isset($property[‘loft_with_elevator_access’])){
    $withelevatoraccess = 35*$property[‘loft_floor’];
    $loftprice += $withelevatoraccess;
    }

    if( isset($property[‘loft_no_stairs’])){
    $no_stairsprice = 35*$property[‘loft_floor’];
    $loftprice += $no_stairsprice;
    }

    return $loftprice;

    break;
    }
    }

    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );

    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’,
    get_stylesheet_directory_uri() . ‘/style.css’,
    array(‘parent-style’)
    );
    wp_enqueue_style( ‘bootstrap’, get_stylesheet_directory_uri() . ‘/css/bootstrap.min.css’);
    wp_enqueue_style( ‘style’, get_stylesheet_directory_uri() . ‘/css/style.css’);
    wp_enqueue_style( ‘mystyle’, get_stylesheet_directory_uri() . ‘/css/mystyle.css’);
    wp_enqueue_style( ‘lightbox’, get_stylesheet_directory_uri() . ‘/css/lightbox.css’);
    wp_enqueue_style( ‘layout’, get_stylesheet_directory_uri() . ‘/css/layout.css’);
    wp_enqueue_style( ‘bx-slider-css’, get_stylesheet_directory_uri(). ‘/css/jquery.bxslider.css’);
    wp_enqueue_style( ‘datetimepicer-css’, get_stylesheet_directory_uri().’/css/jquery.datetimepicker.css’);

    wp_enqueue_script( ‘jquery’ );
    wp_enqueue_script( ‘bx-slider’, get_stylesheet_directory_uri().’/js/jquery.bxslider.min.js’, array(‘jquery’) );
    wp_enqueue_script( ‘datetimepicer-script’, get_stylesheet_directory_uri().’/js/jquery.datetimepicker.js’, array(‘jquery’) );
    wp_enqueue_script( ‘jquery-easing’); //, get_stylesheet_directory_uri().’/js/plugins/jquery.easing.1.3.js’, array(‘jquery’) );
    }

    /****************************************************************************/
    /* Text Area Custom */
    /****************************************************************************/
    if ( ! class_exists( ‘WP_Customize_Control’ ) )
    return NULL;

    class Textarea_Custom_Control extends WP_Customize_Control
    {
    /**
    * Render the control’s content.
    *
    * Allows the content to be overriden without having to rewrite the wrapper.
    *
    * @since 10/16/2012
    * @return void
    */
    public function render_content() {
    ?>
    <label>
    <span class=”customize-control-title”><?php echo esc_html( $this->label ); ?></span>
    <textarea class=”large-text” cols=”20″ rows=”5″ <?php $this->link(); ?>>
    <?php echo esc_textarea( $this->value() ); ?>
    </textarea>
    </label>
    <?php
    }

    }
    /****************************************************************************/
    /* General Setting for the site */
    /****************************************************************************/
    function general_section_customizer( $wp_customize ) {
    $wp_customize->remove_section( ‘title_tagline’);
    $wp_customize->remove_section( ‘colors’);
    $wp_customize->remove_section( ‘background_image’);
    $wp_customize->remove_section( ‘header_image’);
    $wp_customize->remove_section( ‘nav’);

    $wp_customize->add_section(
    ‘general_section’,
    array(
    ‘title’ =>__(‘Home Page Settings for the Site’, ‘_cpm’ ),
    ‘description’ => ‘This is a section for home page options for the site’,
    ‘priority’ => 15,
    )
    );

    $wp_customize->add_setting(‘site_fav_icon’);
    $wp_customize->add_control(
    new WP_Customize_Image_Control(
    $wp_customize,
    ‘favicon-upload’,
    array(
    ‘label’ => __(‘Fav-Icon’, ‘_cpm’ ),
    ‘section’ => ‘general_section’,
    ‘settings’ => ‘site_fav_icon’,
    ‘priority’ => 1
    )
    )
    );

    $wp_customize->add_setting(‘site_logo’);
    $wp_customize->add_control(
    new WP_Customize_Image_Control(
    $wp_customize,
    ‘site-logo’,
    array(
    ‘label’ => __(‘Logo’, ‘_cpm’ ),
    ‘section’ => ‘general_section’,
    ‘settings’ => ‘site_logo’,
    ‘priority’ => 2
    )
    )
    );

    $wp_customize->add_setting(‘site_banner’);
    $wp_customize->add_control(
    new WP_Customize_Image_Control(
    $wp_customize,
    ‘site-banner’,
    array(
    ‘label’ => __(‘Site Banner’, ‘_cpm’ ),
    ‘section’ => ‘general_section’,
    ‘settings’ => ‘site_banner’,
    ‘priority’ => 2
    )
    )
    );

    }

    add_action( ‘customize_register’, ‘general_section_customizer’);

    /***************************************************************************/
    /* Theme customizer section for social media links */
    /**************************************************************************/
    function social_media_section_customizer( $wp_customize ) {
    $wp_customize->add_section(
    ‘social_media_section’,
    array(
    ‘title’ => __( ‘Social Media links’, ‘_cpm’ ),
    ‘description’ => ‘Section for social Media links’,
    ‘priority’ => 25
    )

    );
    $wp_customize->add_setting(
    ‘site_facebook_link’,
    array(
    ‘default’ => ‘https://&#8217;,
    )
    );
    $wp_customize->add_control(
    ‘site_facebook_link’,
    array(
    ‘label’ => __( ‘Facebook Link’, ‘_cpm’ ),
    ‘section’ => ‘social_media_section’,
    ‘type’ => ‘text’,
    ‘priority’ => 1
    )
    );

    $wp_customize->add_setting(
    ‘site_twitter_link’,
    array(
    ‘default’ => ‘https://&#8217;,
    )
    );
    $wp_customize->add_control(
    ‘site_twitter_link’,
    array(
    ‘label’ => __( ‘Twitter Link’, ‘_cpm’ ),
    ‘section’ => ‘social_media_section’,
    ‘type’ => ‘text’,
    ‘priority’ => 3
    )
    );

    $wp_customize->add_setting(
    ‘site_google_plus_link’,
    array(
    ‘default’ => ‘https://&#8217;,
    )
    );
    $wp_customize->add_control(
    ‘site_google_plus_link’,
    array(
    ‘label’ => __( ‘Google Plus Link’, ‘_cpm’ ),
    ‘section’ => ‘social_media_section’,
    ‘type’ => ‘text’,
    ‘priority’ => 4
    )
    );

    }

    add_action(‘customize_register’,’social_media_section_customizer’);

    /*———————around this part code is edited—————*/

    /***************************************************************************/
    /* Theme customizer section for footer part */
    /***************************************************************************/
    function footer_section_customizer( $wp_customize ) {
    $wp_customize->add_section(
    ‘footer_section’,
    array(
    ‘title’ =>__(‘Footer Section’, ‘_cpm’ ),
    ‘description’ => ”,
    ‘priority’ => 55,
    )
    );

    $wp_customize->add_setting(‘googlemap-iframe’);
    $wp_customize->add_control(
    new Textarea_Custom_Control(
    $wp_customize,
    ‘googlemap-iframe’,
    array(
    ‘label’=> __(‘Google Map Iframe’, ‘cpm’),
    ‘section’=> ‘footer_section’,
    ‘settings’=> ‘googlemap-iframe’,
    ‘priority’=> 3
    )
    )
    );

    $wp_customize->add_setting(
    ‘location’ );
    $wp_customize->add_control(
    ‘location’,
    array(
    ‘label’ => __( ‘Location’, ‘_cpm’ ),
    ‘section’ => ‘footer_section’,
    ‘type’ => ‘text’,
    ‘priority’ => 1
    )
    );

    $wp_customize->add_setting(
    ‘phone’);
    $wp_customize->add_control(
    ‘phone’,
    array(
    ‘label’ => __( ‘Phone’, ‘_cpm’ ),
    ‘section’ => ‘footer_section’,
    ‘type’ => ‘text’,
    ‘priority’ => 2
    )
    );

    $wp_customize->add_setting(
    ’email’);
    $wp_customize->add_control(
    ’email’,
    array(
    ‘label’ => __( ‘Email Address’, ‘_cpm’ ),
    ‘section’ => ‘footer_section’,
    ‘type’ => ‘text’,
    ‘priority’ => 3
    )
    );

    }
    add_action( ‘customize_register’, ‘footer_section_customizer’ );

    /**
    * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
    */
    function _cpm_customize_preview_js() {
    wp_enqueue_script( ‘_cpm_customizer’, get_template_directory_uri() . ‘/js/customizer.js’, array( ‘customize-preview’ ), ‘20130508’, true );
    }

    add_action( ‘customize_preview_init’, ‘_cpm_customize_preview_js’ );

    function set_html_content_type() {

    return ‘text/html’;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Parse error: syntax error, unexpected '}', expecting ',' or ';' in /ho’ is closed to new replies.