0

I am facing following error after uploading updated theme folder on server that theme folder is working fine on local machine. Error is below:

Parse error: syntax error, unexpected 'function' (T_FUNCTION) in /home1/mudinta/public_html/wp-content/themes/BookYourTravel/includes/theme_filters.php on line 1

theme_filter.php file code is below:

<?php

/**
 * Remove password email text if option for users to set their own password is enabled in Theme settings.
 */
function remove_password_email_text ( $text ) {
    $let_users_set_pass = of_get_option('let_users_set_pass', 0);
    if ($text == 'A password will be e-mailed to you.' && $let_users_set_pass)
        $text = '';
    return $text;
}
add_filter( 'gettext', 'remove_password_email_text' );

/**
 * Function that renders labeled field in the form of
 * <div class="container_css_class"><span>$label_text</span> $field_value</div>
 */
function byt_render_labeled_field_value($container_css_class, $label_css_class, $label_text, $field_value, $header_text = '', $paragraph = false) {
    if (!empty($field_value) || !empty($label_text)) {
        $ret_val = '';

        if (!empty($header_text))
            $ret_val = sprintf("<h1>%s</h1>", $header_text);

        if (!empty($container_css_class))
            $ret_val .= sprintf("<div class='%s'>", $container_css_class);

        if ($paragraph)
            $ret_val .= '<p>';

        if (!empty($label_text) || !empty($label_css_class)) 
            $ret_val .= sprintf("<span class='%s'>%s</span>", $label_css_class, $label_text);

        if (!empty($field_value)) 
            $ret_val .= $field_value;
        if ($paragraph)
            $ret_val .= '</p>';
        if (!empty($container_css_class))
            $ret_val .= '</div>';
        $ret_val = apply_filters('byt_render_labeled_field_value', $ret_val, $container_css_class, $label_css_class, $label_text, $field_value, $header_text, $paragraph);

        echo $ret_val;
    }
}

/**
 * Function that renders image tag in the form of
 * <img class="image_css_class" id="$image_id" src="$image_src" title="$image_title" alt="$image_alt" />
 */
function byt_render_image($image_css_class, $image_id, $image_src, $image_title, $image_alt, $echo = true) {
    if ( !empty( $image_src) ) {
        $ret_val = sprintf("<img class='%s' id='%s' src='%s' title='%s' alt='%s' />", $image_css_class, $image_id, $image_src, $image_title, $image_alt);
        $ret_val = apply_filters('byt_render_image', $ret_val, $image_css_class, $image_id, $image_src, $image_title, $image_alt);
        if ($echo)
            echo $ret_val;
        else
            return $ret_val;
    }
    return "";
}

/**
 * Function that renders list item in the form of
 * <li class="item_css_class" id="$item_id">$item_content</li>
 */
function byt_render_list_item($page_post_type, $item_css_class, $item_id, $item_content) {
    $ret_val = sprintf("<li class='%s' id='%s'>%s</li>", $item_css_class, $item_id, $item_content);
    $ret_val = apply_filters('byt_render_list_item', $ret_val, $page_post_type, $item_css_class, $item_id, $item_content);
    echo $ret_val;
}

/**
 * Function that renders link button in the form of
 * <a href="$href" class="$link_css_class" id="$link_id" title="$text">$text</a>
 */
function byt_render_link_button($href, $link_css_class, $link_id, $text)  {
    $ret_val = sprintf("<a href='%s' class='%s' ", $href, $link_css_class);
    if (!empty($link_id))
        $ret_val .= sprintf(" id='%s' ", $link_id);
    $ret_val .= sprintf(" title='%s'>%s</a>", $text, $text);

    $ret_val = apply_filters('byt_render_link_button', $ret_val, $href, $link_css_class, $link_id, $text);
    echo $ret_val;
}

/**
 * Function that renders submit button in the form of
 * <input type="submit" value="$text" id="$submit_id" name="$submit_id" class="$submit_css_class" />
 */
function byt_render_submit_button($submit_css_class, $submit_id, $text)  {
    $ret_val = sprintf("<input type='submit' class='%s' id='%s' name='%s' value='%s' />", $submit_css_class, $submit_id, $submit_id, $text);
    $ret_val = apply_filters('byt_render_link_button', $ret_val, $submit_css_class, $submit_id, $submit_id, $text);
    echo $ret_val;
}
?>
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
VATSHAL
  • 1,529
  • 2
  • 12
  • 12
  • http://stackoverflow.com/questions/21499668/parse-error-syntax-error-unexpected-t-function-please-help-includes-theme-filt – Anju Aravind Jun 23 '14 at 10:10
  • Thanks for your response, but i didn't got any solution from this link with is provided by you because, this code is working on WAMP server on local machine but showing error on live server. – VATSHAL Jun 23 '14 at 10:13
  • Maybe [this](http://stackoverflow.com/q/4410704/1287812). And how is this file being included? – brasofilo Jun 23 '14 at 10:33

1 Answers1

0

When i upload file into server it convert file code into single line like this:

<?php/*some comment here*/function xyz...?>

I formatted code like this:

<?php 
/*some comment here*/

function xyz...
.
.
.
?>

and its work fine for me.

VATSHAL
  • 1,529
  • 2
  • 12
  • 12