Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I get this error when I enter data in my form

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in

\functions.php on line 77

return '<span class="vwbx">Views</span>''<span class="vwbx">$count.</span>';

==== Whole function===

function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    return "0 View";
}
return $count. '<span class="vwbx">Views</span>''<span class="vwbx">views</span>';
}
share|improve this question

1 Answer

up vote 1 down vote accepted

The problem is that you have two strings that aren't actually being appended together.

Try replacing

return $count. '<span class="vwbx">Views</span>''<span class="vwbx">views</span>';

With

return $count. '<span class="vwbx">Views</span>'.'<span class="vwbx">views</span>';

(note the added period in the centre).

Or instead, remove the two quotation marks from the centre:

return $count. '<span class="vwbx">Views</span><span class="vwbx">views</span>';

That should work :D

EDIT In response to your comment... I think you'll be wanting to replace it with:

return '<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">'.$count.'</span>';
share|improve this answer
thanks Harris working but i need to do this, to get $count value like return '<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">$count.</span>'; – user8503 Jan 18 '12 at 14:23
1  
I've edited my answer :D. By the way, you may want to start accepting answers to your questions - your score is very low and people may decide not to bother answering you. – Stephen Harris Jan 18 '12 at 14:27
thanks Harris :) – user8503 Jan 18 '12 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.